add background truecolor support

This commit is contained in:
2025-03-27 22:53:02 -04:00
parent 31ae40b96a
commit 25f2697eec
2 changed files with 8 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -3,5 +3,5 @@
version = 4 version = 4
[[package]] [[package]]
name = "neutrino" name = "neutuino"
version = "0.1.0" version = "0.1.0"

View File

@@ -6,10 +6,16 @@
/// Sets the terminal to an arbitrary 12-bit/truecolor color /// Sets the terminal to an arbitrary 12-bit/truecolor color
#[must_use] #[must_use]
pub fn rgb_color_code(red: u8, green: u8, blue: u8) -> String { pub fn rgb_color_code_fg(red: u8, green: u8, blue: u8) -> String {
format!("\x1b[38;2;{red};{green};{blue}m") format!("\x1b[38;2;{red};{green};{blue}m")
} }
/// Sets the terminal to an arbitrary 12-bit/truecolor color
#[must_use]
pub fn rgb_color_code_bg(red: u8, green: u8, blue: u8) -> String {
format!("\x1b[48;2;{red};{green};{blue}m")
}
/// Sets the title of the window /// Sets the title of the window
/// ///
/// The title must be only in ASCII characters or **weird** things will happen /// The title must be only in ASCII characters or **weird** things will happen