pub struct ThemeColor {
pub rgb: (u8, u8, u8),
pub ansi256: u8,
pub plain_marker: Option<&'static str>,
}Expand description
A color that can be rendered differently based on output mode.
Contains both truecolor RGB and ANSI-256 fallback values, plus an optional plain text marker for non-color output.
Fields§
§rgb: (u8, u8, u8)RGB color for truecolor terminals (r, g, b).
ansi256: u8ANSI 256-color fallback for older terminals.
plain_marker: Option<&'static str>Plain text marker (for plain mode output), e.g., “NULL” for null values.
Implementations§
Source§impl ThemeColor
impl ThemeColor
Sourcepub const fn new(rgb: (u8, u8, u8), ansi256: u8) -> Self
pub const fn new(rgb: (u8, u8, u8), ansi256: u8) -> Self
Create a theme color with RGB and ANSI-256 fallback.
§Example
use sqlmodel_console::theme::ThemeColor;
let green = ThemeColor::new((80, 250, 123), 84);Sourcepub const fn with_marker(
rgb: (u8, u8, u8),
ansi256: u8,
marker: &'static str,
) -> Self
pub const fn with_marker( rgb: (u8, u8, u8), ansi256: u8, marker: &'static str, ) -> Self
Create a theme color with a plain text marker.
The marker is used in plain mode to indicate special values like NULL without using colors.
§Example
use sqlmodel_console::theme::ThemeColor;
let null_color = ThemeColor::with_marker((98, 114, 164), 60, "NULL");Sourcepub const fn plain_marker(&self) -> Option<&'static str>
pub const fn plain_marker(&self) -> Option<&'static str>
Get the plain text marker, if any.
Sourcepub fn color_code(&self) -> String
pub fn color_code(&self) -> String
Get a truecolor ANSI escape sequence for this color.
Returns a string like \x1b[38;2;R;G;Bm for foreground color.
Trait Implementations§
Source§impl Clone for ThemeColor
impl Clone for ThemeColor
Source§fn clone(&self) -> ThemeColor
fn clone(&self) -> ThemeColor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemeColor
impl Debug for ThemeColor
Source§impl PartialEq for ThemeColor
impl PartialEq for ThemeColor
impl Copy for ThemeColor
impl Eq for ThemeColor
impl StructuralPartialEq for ThemeColor
Auto Trait Implementations§
impl Freeze for ThemeColor
impl RefUnwindSafe for ThemeColor
impl Send for ThemeColor
impl Sync for ThemeColor
impl Unpin for ThemeColor
impl UnwindSafe for ThemeColor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more