Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Bright Colors #34

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions ansi/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ pub(crate) fn foreground(color: Color) -> &'static str {
Color::Cyan => "36",
Color::White => "37",
Color::Default => "39",

Color::BrightBlack => "90",
Color::BrightRed => "91",
Color::BrightGreen => "92",
Color::BrightYellow => "93",
Color::BrightBlue => "94",
Color::BrightMagenta => "95",
Color::BrightCyan => "96",
Color::BrightWhite => "97",

_ => "39",
}
}
Expand All @@ -26,6 +36,16 @@ pub(crate) fn background(color: Color) -> &'static str {
Color::Cyan => "46",
Color::White => "47",
Color::Default => "49",

Color::BrightBlack => "100",
Color::BrightRed => "101",
Color::BrightGreen => "102",
Color::BrightYellow => "103",
Color::BrightBlue => "104",
Color::BrightMagenta => "105",
Color::BrightCyan => "106",
Color::BrightWhite => "107",

_ => "49",
}
}
Expand Down
20 changes: 20 additions & 0 deletions html/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ pub(crate) fn foreground(color: Color) -> &'static str {
Color::Cyan => "color:cyan",
Color::White => "color:white",
Color::Default => "color:inherit",

Color::BrightBlack => "color:gray",
Color::BrightRed => "color:#af0000",
Color::BrightGreen => "color:#00ff00",
Color::BrightYellow => "color:#ffff00",
Color::BrightBlue => "color:#0000ff",
Color::BrightMagenta => "color:#ff00ff",
Color::BrightCyan => "color:#00ffff",
Color::BrightWhite => "color:#ffffff",

_ => "color:inherit",
}
}
Expand All @@ -26,6 +36,16 @@ pub(crate) fn background(color: Color) -> &'static str {
Color::Cyan => "background-color:cyan",
Color::White => "background-color:white",
Color::Default => "background-color:inherit",

Color::BrightBlack => "background-color:gray",
Color::BrightRed => "background-color:#af0000",
Color::BrightGreen => "background-color:#00ff00",
Color::BrightYellow => "background-color:#ffff00",
Color::BrightBlue => "background-color:#0000ff",
Color::BrightMagenta => "background-color:#ff00ff",
Color::BrightCyan => "background-color:#00ffff",
Color::BrightWhite => "background-color:#ffffff",

_ => "background-color:inherit",
}
}
Expand Down
16 changes: 16 additions & 0 deletions style/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ pub enum Color {
Cyan,
/// White
White,
// Bright Black
BrightBlack,
// Bright Red
BrightRed,
// Bright Green
BrightGreen,
// Bright Yellow
BrightYellow,
// Bright Blue
BrightBlue,
// Bright Magenta
BrightMagenta,
// Bright Cyan
BrightCyan,
// Bright White
BrightWhite,
/// Default color
Default,
}
Expand Down
Loading