terminal: Clean up doc comment for rgb_for_index (#3947)

This PR cleans up the doc comment for the `rgb_for_index` function.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-01-08 13:33:41 -05:00 committed by GitHub
parent 1bf7afd839
commit 00fc22a461
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1459,14 +1459,16 @@ pub fn get_color_at_index(index: usize, theme: &Theme) -> Hsla {
} }
} }
///Generates the rgb channels in [0, 5] for a given index into the 6x6x6 ANSI color cube /// Generates the RGB channels in [0, 5] for a given index into the 6x6x6 ANSI color cube.
///See: [8 bit ansi color](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit). /// See: [8 bit ANSI color](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit).
/// ///
///Wikipedia gives a formula for calculating the index for a given color: /// Wikipedia gives a formula for calculating the index for a given color:
/// ///
///index = 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5) /// ```
/// index = 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5)
/// ```
/// ///
///This function does the reverse, calculating the r, g, and b components from a given index. /// This function does the reverse, calculating the `r`, `g`, and `b` components from a given index.
fn rgb_for_index(i: &u8) -> (u8, u8, u8) { fn rgb_for_index(i: &u8) -> (u8, u8, u8) {
debug_assert!((&16..=&231).contains(&i)); debug_assert!((&16..=&231).contains(&i));
let i = i - 16; let i = i - 16;