From 25f2697eecccdeba883aec27aafcc6702827756c Mon Sep 17 00:00:00 2001 From: Xyverle Date: Thu, 27 Mar 2025 22:53:02 -0400 Subject: [PATCH] add background truecolor support --- Cargo.lock | 2 +- src/ansi.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7aa7828..549f278 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 4 [[package]] -name = "neutrino" +name = "neutuino" version = "0.1.0" diff --git a/src/ansi.rs b/src/ansi.rs index 76413ce..d0dbd3f 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -6,10 +6,16 @@ /// Sets the terminal to an arbitrary 12-bit/truecolor color #[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") } +/// 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 /// /// The title must be only in ASCII characters or **weird** things will happen