added rgb byte splitter method to clean up color definitions

This commit is contained in:
Valerie Wolfe 2023-06-19 20:31:30 -04:00
parent 4f051170ac
commit a5ea3da3b6
2 changed files with 47 additions and 41 deletions

View file

@ -9,3 +9,9 @@ pub static WHITE: Color = Fg(Rgb(0xFF, 0xFF, 0xFF));
pub static RESET: Fg<Reset> = Fg(Reset); pub static RESET: Fg<Reset> = Fg(Reset);
pub fn rgb(hex: u32) -> Color {
let [_, r, g, b] = hex.to_be_bytes();
Fg(Rgb(r, g, b))
}

View file

@ -6,19 +6,19 @@ use crate::color::*;
pub static BLOCK: &str = ""; pub static BLOCK: &str = "";
pub fn pride() -> Colors { pub fn pride() -> Colors {
let red = color::Fg(color::Rgb(0xE5, 0x00, 0x00)); let red = rgb(0xE50000);
let orange = color::Fg(color::Rgb(0xFF, 0x8D, 0x00)); let orange = rgb(0xFF8D00);
let yellow = color::Fg(color::Rgb(0xFF, 0xEE, 0x00)); let yellow = rgb(0xFFEE00);
let green = color::Fg(color::Rgb(0x02, 0x81, 0x21)); let green = rgb(0x028121);
let blue = color::Fg(color::Rgb(0x00, 0x4C, 0xFF)); let blue = rgb(0x004CFF);
let purple = color::Fg(color::Rgb(0x77, 0x00, 0x88)); let purple = rgb(0x770088);
vec![red, orange, yellow, green, blue, purple] vec![red, orange, yellow, green, blue, purple]
} }
pub fn transgender() -> Colors { pub fn transgender() -> Colors {
let pink = color::Fg(color::Rgb(0x7A, 0xCB, 0xF5)); let pink = rgb(0x7ACBF5);
let blue = color::Fg(color::Rgb(0xEA, 0xAC, 0xB8)); let blue = rgb(0xEAACB8);
vec![pink, blue, WHITE, blue, pink] vec![pink, blue, WHITE, blue, pink]
} }
@ -26,94 +26,94 @@ pub fn transgender() -> Colors {
// everything below here is alphabetical // everything below here is alphabetical
pub fn agender() -> Colors { pub fn agender() -> Colors {
let gray = color::Fg(color::Rgb(0xB9, 0xB9, 0xB9)); let gray = rgb(0xB9B9B9);
let green = color::Fg(color::Rgb(0xB8, 0xF4, 0x83)); let green = rgb(0xB8F483);
vec![BLACK, gray, WHITE, green, WHITE, gray, BLACK] vec![BLACK, gray, WHITE, green, WHITE, gray, BLACK]
} }
pub fn aromantic() -> Colors { pub fn aromantic() -> Colors {
let green = color::Fg(color::Rgb(0x3B, 0xA7, 0x40)); let green = rgb(0x3BA740);
let lime = color::Fg(color::Rgb(0xA8, 0xD4, 0x7A)); let lime = rgb(0xA8D47A);
let grey = color::Fg(color::Rgb(0xAB, 0xAB, 0xAB)); let grey = rgb(0xABABAB);
vec![green, lime, WHITE, grey, BLACK] vec![green, lime, WHITE, grey, BLACK]
} }
pub fn asexual() -> Colors { pub fn asexual() -> Colors {
let grey = color::Fg(color::Rgb(0xA4, 0xA4, 0xA4)); let grey = rgb(0xA4A4A4);
let purple = color::Fg(color::Rgb(0x81, 0x00, 0x81)); let purple = rgb(0x810081);
vec![BLACK, grey, WHITE, purple] vec![BLACK, grey, WHITE, purple]
} }
pub fn bigender() -> Colors { pub fn bigender() -> Colors {
let pink = color::Fg(color::Rgb(0xE6, 0x76, 0xA6)); let pink = rgb(0xE676A6);
let yellow = color::Fg(color::Rgb(0xF9, 0xF0, 0x4C)); let yellow = rgb(0xF9F04C);
let purple = color::Fg(color::Rgb(0xAB, 0x6B, 0xBB)); let purple = rgb(0xAB6BBB);
let blue = color::Fg(color::Rgb(0x6D, 0x96, 0xDC)); let blue = rgb(0x6D96DC);
vec![pink, yellow, WHITE, purple, blue] vec![pink, yellow, WHITE, purple, blue]
} }
pub fn bisexual() -> Colors { pub fn bisexual() -> Colors {
let magenta = color::Fg(color::Rgb(0xC4, 0x2A, 0x6F)); let magenta = rgb(0xC42A6F);
let purple = color::Fg(color::Rgb(0x91, 0x53, 0x92)); let purple = rgb(0x915392);
let blue = color::Fg(color::Rgb(0x14, 0x37, 0xA2)); let blue = rgb(0x1437A2);
vec![magenta, magenta, purple, blue, blue] vec![magenta, magenta, purple, blue, blue]
} }
pub fn genderfluid() -> Colors { pub fn genderfluid() -> Colors {
let pink = color::Fg(color::Rgb(0xFF, 0x75, 0xA2)); let pink = rgb(0xFF75A2);
let violet = color::Fg(color::Rgb(0xBE, 0x18, 0xD6)); let violet = rgb(0xBE18D6);
let blue = color::Fg(color::Rgb(0x33, 0x3E, 0xBD)); let blue = rgb(0x333EBD);
vec![pink, WHITE, violet, BLACK, blue] vec![pink, WHITE, violet, BLACK, blue]
} }
pub fn genderqueer() -> Colors { pub fn genderqueer() -> Colors {
let purple = color::Fg(color::Rgb(0xB8, 0x99, 0xDF)); let purple = rgb(0xB899DF);
let green = color::Fg(color::Rgb(0x6B, 0x8E, 0x3B)); let green = rgb(0x6B8E3B);
vec![purple, WHITE, green] vec![purple, WHITE, green]
} }
pub fn gendervoid() -> Colors { pub fn gendervoid() -> Colors {
let navy = color::Fg(color::Rgb(0x08, 0x11, 0x4A)); let navy = rgb(0x08114A);
let gray = color::Fg(color::Rgb(0x4A, 0x48, 0x4B)); let gray = rgb(0x4A484B);
vec![navy, gray, BLACK, gray, navy] vec![navy, gray, BLACK, gray, navy]
} }
pub fn lesbian() -> Colors { pub fn lesbian() -> Colors {
let red = color::Fg(color::Rgb(0xD6, 0x28, 0x00)); let red = rgb(0xD62800);
let orange = color::Fg(color::Rgb(0xFF, 0x9B, 0x56)); let orange = rgb(0xFF9B56);
let pink = color::Fg(color::Rgb(0xD4, 0x62, 0xA6)); let pink = rgb(0xD462A6);
let magenta = color::Fg(color::Rgb(0xA4, 0x00, 0x62)); let magenta = rgb(0xA40062);
vec![red, orange, WHITE, pink, magenta] vec![red, orange, WHITE, pink, magenta]
} }
pub fn multigender() -> Colors { pub fn multigender() -> Colors {
let blue = color::Fg(color::Rgb(0x3F, 0x47, 0xCC)); let blue = rgb(0x3F47CC);
let ltblue = color::Fg(color::Rgb(0x01, 0xA4, 0xE9)); let ltblue = rgb(0x01A4E9);
let orange = color::Fg(color::Rgb(0xFB, 0x7F, 0x27)); let orange = rgb(0xFB7F27);
vec![blue, ltblue, orange, ltblue, blue] vec![blue, ltblue, orange, ltblue, blue]
} }
pub fn nonbinary() -> Colors { pub fn nonbinary() -> Colors {
let yellow = color::Fg(color::Rgb(0xFF, 0xF4, 0x33)); let yellow = rgb(0xFFF433);
let purple = color::Fg(color::Rgb(0x9B, 0x59, 0xD0)); let purple = rgb(0x9B59D0);
vec![yellow, WHITE, purple, BLACK] vec![yellow, WHITE, purple, BLACK]
} }
pub fn pansexual() -> Colors { pub fn pansexual() -> Colors {
let magenta = color::Fg(color::Rgb(0xFF, 0x1B, 0x8D)); let magenta = rgb(0xFF1B8D);
let yellow = color::Fg(color::Rgb(0xFF, 0xDA, 0x00)); let yellow = rgb(0xFFDA00);
let cyan = color::Fg(color::Rgb(0x1B, 0xB3, 0xFF)); let cyan = rgb(0x1BB3FF);
vec![magenta, yellow, cyan] vec![magenta, yellow, cyan]
} }