Skip to content

Commit

Permalink
feat: Add palette color struct with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Syaw0 committed Nov 1, 2024
1 parent 27dc04f commit 5adde3c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ pub const BRIGHT_MAGENTA: BasicColor = BasicColor { fg: 95, bg: 105 };
pub const BRIGHT_CYAN: BasicColor = BasicColor { fg: 96, bg: 106 };
pub const BRIGHT_WHITE: BasicColor = BasicColor { fg: 97, bg: 107 };

//

pub struct PaletteColor {
pub index: u8,
}

// =======================================================================

#[cfg(test)]
Expand All @@ -37,4 +43,16 @@ mod test {
assert_eq!(36, CYAN.fg);
assert_eq!(46, CYAN.bg)
}

#[test]
fn black_palette_color() {
let standard_black = PaletteColor { index: 0 };
assert_eq!(0, standard_black.index)
}

#[test]
fn _palette_color() {
let gray_scale = PaletteColor { index: 243 };
assert_eq!(243, gray_scale.index)
}
}

0 comments on commit 5adde3c

Please sign in to comment.