diff --git a/assets/theme-template.ron b/assets/theme-template.ron index b747b77..0c0fb64 100644 --- a/assets/theme-template.ron +++ b/assets/theme-template.ron @@ -1,99 +1,124 @@ +/// Usually, those with 'bg' indicate background color, while those without it typically indicate foreground color. +/// +/// Kind Enum: Light | Dark +/// Color Enum: +/// - Tailwind(RED, C700): https://tailwindcss.com/docs/customizing-colors +/// - Rgb(10, 20, 255) : Rgb(u8, u8, u8), u8: 0 ~ 255 +/// - Hex("ffffff") : Rgb color in radix-16, in the format: 0xRRGGBB +/// - Default : Depend on terminal background & foreground +/// - Fallback : Fallback to Light | Dark kind defined color +/// - Black : ANSI Color: Black. Foreground: 30, Background: 40 +/// - Red : ANSI Color: Red. Foreground: 31, Background: 41 +/// - Green : ANSI Color: Green. Foreground: 32, Background: 42 +/// - Yellow : ANSI Color: Yellow. Foreground: 33, Background: 43 +/// - Blue : ANSI Color: Blue. Foreground: 34, Background: 44 +/// - Magenta : ANSI Color: Magenta. Foreground: 35, Background: 45 +/// - Cyan : ANSI Color: Cyan. Foreground: 36, Background: 46 +/// - Gray : ANSI Color: White. Foreground: 37, Background: 47 +/// - DarkGray : ANSI Color: Bright Black. Foreground: 90, Background: 100 +/// - LightRed : ANSI Color: Bright Red. Foreground: 91, Background: 101 +/// - LightGreen : ANSI Color: Bright Green. Foreground: 92, Background: 102 +/// - LightYellow : ANSI Color: Bright Yellow. Foreground: 93, Background: 103 +/// - LightBlue : ANSI Color: Bright Blue. Foreground: 94, Background: 104 +/// - LightMagenta : ANSI Color: Bright Magenta. Foreground: 95, Background: 105 +/// - LightCyan : ANSI Color: Bright Cyan. Foreground: 96, Background: 106 +/// - White : ANSI Color: Bright White. Foreground: 97, Background: 107 ( - name: "", - kind: Dark, // Dark | Light + name: "ratisui-dark", + kind: Dark, context: ( - fps_fg: Fallback, // Tailwind(RED, C700) | Rgb(10, 20, 255) | Hex("ffffff") | Default | Fallback - icon_bg: Fallback, + fps: Tailwind(GRAY, C500), + key_bg: Tailwind(YELLOW, C700), ), server: ( - highlight: Fallback, - name: Fallback, - location: Fallback, - db: Fallback, - username: Fallback, - tls: Fallback, - protocol: Fallback, + highlight: Default, + name: Tailwind(AMBER, C400), + location: Tailwind(CYAN, C500), + db: Tailwind(BLUE, C600), + username: Tailwind(AMBER, C400), + tls: Tailwind(ROSE, C600), + protocol: Tailwind(EMERALD, C600), ), table: ( - buffer_bg: Fallback, - header_bg: Fallback, - header_fg: Fallback, - row_fg: Fallback, - normal_row_color: Fallback, - alt_row_color: Fallback, + bg: Default, + header_bg: Tailwind(GRAY, C900), + header: Tailwind(GRAY, C200), + row: Tailwind(GRAY, C200), + odd_row_bg: Default, + even_row_bg: Tailwind(GRAY, C950), ), raw: ( - string: Fallback, - boolean: Fallback, - keyword: Fallback, - constant: Fallback, - null: Fallback, - property: Fallback, - comment: Fallback, - number: Fallback, + string: Tailwind(AMBER, C400), + boolean: Tailwind(ROSE, C600), + keyword: Tailwind(ROSE, C600), + constant: Tailwind(ROSE, C600), + null: Tailwind(ROSE, C600), + property: Tailwind(FUCHSIA, C700), + comment: Tailwind(CYAN, C500), + number: Tailwind(BLUE, C600), ), border: ( - highlight: Fallback, - default: Fallback, + highlight: Tailwind(GRAY, C300), + default: Tailwind(GRAY, C600), ), editor: ( - editing: Fallback, - warning: Fallback, + editing: Tailwind(SKY, C700), + warning: Tailwind(RED, C700), ), tab: ( - title_fg: Fallback, + title: Tailwind(SLATE, C200), explorer: ( - accent: Fallback, - highlight: Fallback, + accent: Tailwind(ROSE, C900), + highlight: Tailwind(ROSE, C700), tree: ( - highlight: Fallback, + highlight: Tailwind(ROSE, C700), ), key_type: ( - hash: Fallback, - list: Fallback, - set: Fallback, - zset: Fallback, - string: Fallback, - json: Fallback, - stream: Fallback, - unknown: Fallback, + hash: Tailwind(BLUE, C700), + list: Tailwind(GREEN, C700), + set: Tailwind(ORANGE, C700), + zset: Tailwind(PINK, C700), + string: Tailwind(PURPLE, C700), + json: Tailwind(GRAY, C700), + stream: Tailwind(YELLOW, C700), + unknown: Tailwind(SLATE, C500), ), ), cli: ( - accent: Fallback, - highlight: Fallback, + accent: Tailwind(GREEN, C900), + highlight: Tailwind(GREEN, C700), console: ( - cmd: Fallback, - out: Fallback, - err: Fallback, + cmd: Tailwind(EMERALD, C700), + out: Default, + err: Tailwind(ROSE, C700), ), menu: ( - bg: Fallback, - highlight: Fallback, - info: Fallback, - desc_bg: Fallback, - input: Fallback, + bg: Tailwind(NEUTRAL, C800), + highlight: Tailwind(ZINC, C900), + info_bg: Tailwind(STONE, C900), + input: Tailwind(AMBER, C500), ), doc: ( - command: Fallback, - attribute: Fallback, + bg: Tailwind(NEUTRAL, C800), + command: Tailwind(AMBER, C400), + attribute: Tailwind(PINK, C800), ), ), logger: ( - accent: Fallback, - highlight: Fallback, + accent: Tailwind(AMBER, C900), + highlight: Tailwind(AMBER, C700), level: ( - error: Fallback, - warn: Fallback, - info: Fallback, - debug: Fallback, - trace: Fallback, + error: Tailwind(ROSE, C700), + warn: Tailwind(AMBER, C700), + info: Tailwind(CYAN, C700), + debug: Tailwind(EMERALD, C700), + trace: Tailwind(VIOLET, C700), ), ), ), toast: ( - info: Fallback, - warn: Fallback, - error: Fallback, + info: Tailwind(GREEN, C700), + warn: Tailwind(YELLOW, C700), + error: Tailwind(RED, C700), ), ) diff --git a/examples/theme.rs b/examples/theme.rs index f017999..335fa1d 100644 --- a/examples/theme.rs +++ b/examples/theme.rs @@ -1,10 +1,9 @@ use anyhow::{Context, Result}; +use ron::ser::PrettyConfig; use ratisui::theme::{Color, Tab, Theme}; fn main() -> Result<()> { - let mut theme = Theme::default(); - let mut tab = Tab::default(); - theme.tab = tab; + println!("{}", ron::ser::to_string_pretty(&Theme::dark(), PrettyConfig::default())?); let r_color = Color::hex("ffffff").to_color().context("")?; assert!(matches!(r_color, ratatui::style::Color::Rgb(255,255,255))); diff --git a/src/components/hash_table.rs b/src/components/hash_table.rs index 45d8bf8..53554d7 100644 --- a/src/components/hash_table.rs +++ b/src/components/hash_table.rs @@ -145,8 +145,8 @@ impl HashValue { let mut selected_height = 5; let rows = self.items.iter().enumerate().map(|(i, data)| { let color = match i % 2 { - 0 => self.colors.normal_row_color, - _ => self.colors.alt_row_color, + 0 => self.colors.normal_row, + _ => self.colors.alt_row, }; let item; let height: u16; @@ -198,7 +198,7 @@ impl HashValue { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.colors.buffer_bg) + .bg(self.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.state); } diff --git a/src/components/list_table.rs b/src/components/list_table.rs index 1cacb47..560af2f 100644 --- a/src/components/list_table.rs +++ b/src/components/list_table.rs @@ -140,8 +140,8 @@ impl ListValue { let mut selected_height = 5; let rows = self.items.iter().enumerate().map(|(i, data)| { let color = match i % 2 { - 0 => self.colors.normal_row_color, - _ => self.colors.alt_row_color, + 0 => self.colors.normal_row, + _ => self.colors.alt_row, }; let item; let height: u16; @@ -192,7 +192,7 @@ impl ListValue { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.colors.buffer_bg) + .bg(self.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.state); } diff --git a/src/components/mod.rs b/src/components/mod.rs index 9105769..c1e1b52 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -18,23 +18,29 @@ pub mod raw_paragraph; pub mod stream_view; struct TableColors { - buffer_bg: Color, + // table background + bg: Color, + // header background header_bg: Color, + // header foreground header_fg: Color, + // row foreground row_fg: Color, - normal_row_color: Color, - alt_row_color: Color, + // odd-numbered row + normal_row: Color, + // even-numbered row + alt_row: Color, } impl TableColors { fn new() -> Self { Self { - buffer_bg: get_color(|t| &t.table.buffer_bg), + bg: get_color(|t| &t.table.bg), header_bg: get_color(|t| &t.table.header_bg), - header_fg: get_color(|t| &t.table.header_fg), - row_fg: get_color(|t| &t.table.row_fg), - normal_row_color: get_color(|t| &t.table.normal_row_color), - alt_row_color: get_color(|t| &t.table.alt_row_color), + header_fg: get_color(|t| &t.table.header), + row_fg: get_color(|t| &t.table.row), + normal_row: get_color(|t| &t.table.odd_row_bg), + alt_row: get_color(|t| &t.table.even_row_bg), } } } \ No newline at end of file diff --git a/src/components/redis_cli.rs b/src/components/redis_cli.rs index c3ed2dc..6f2625d 100644 --- a/src/components/redis_cli.rs +++ b/src/components/redis_cli.rs @@ -297,7 +297,7 @@ impl RedisCli<'_> { fn render_menu_footer(&mut self, frame: &mut Frame, area: Rect) { let horizontal = Layout::horizontal([Fill(1), Length(7)]).split(area); let selected = self.table_state.selected().unwrap_or(0); - let style = Style::default().bg(get_color(|t| &t.tab.cli.menu.info)).italic(); + let style = Style::default().bg(get_color(|t| &t.tab.cli.menu.info_bg)).italic(); let info = Line::raw("↑/↓ Tab").style(style); let item_count = Line::raw(format!("{}:{}", selected.saturating_add(1), self.completion_items.len())) .alignment(Alignment::Right) @@ -315,7 +315,7 @@ impl RedisCli<'_> { let paragraph = Paragraph::new(highlight_doc(&doc)) .wrap(Wrap { trim: false }) .block(Block::default().border_set(symbols::border::EMPTY).borders(Borders::from_bits_retain(0b1010))) - .style(Style::default().bg(get_color(|t| &t.tab.cli.menu.desc_bg))) + .style(Style::default().bg(get_color(|t| &t.tab.cli.doc.bg))) ; let line_count = paragraph.line_count(desc_width - 2); // block width 2 let desc_height = cmp::min(line_count as u16, self.max_desc_height); diff --git a/src/components/servers.rs b/src/components/servers.rs index d659d4d..befbc75 100644 --- a/src/components/servers.rs +++ b/src/components/servers.rs @@ -207,7 +207,7 @@ impl ServerList { .fg(self.colors.header_fg) .bg(self.colors.header_bg); let selected_style = Style::default() - .bg(self.colors.alt_row_color) + .bg(self.colors.alt_row) ; let header = ["", "Name", "Location", "DB", "Username", "TLS", "Protocol"] @@ -248,7 +248,7 @@ impl ServerList { .header(header) .row_highlight_style(selected_style) .highlight_symbol(Text::raw(bar)) - .bg(self.colors.buffer_bg) + .bg(self.colors.bg) .column_spacing(1) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.state); diff --git a/src/components/set_table.rs b/src/components/set_table.rs index f7acb3d..4aca785 100644 --- a/src/components/set_table.rs +++ b/src/components/set_table.rs @@ -140,8 +140,8 @@ impl SetValue { let mut selected_height = 5; let rows = self.items.iter().enumerate().map(|(i, data)| { let color = match i % 2 { - 0 => self.colors.normal_row_color, - _ => self.colors.alt_row_color, + 0 => self.colors.normal_row, + _ => self.colors.alt_row, }; let item; let height: u16; @@ -192,7 +192,7 @@ impl SetValue { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.colors.buffer_bg) + .bg(self.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.state); } diff --git a/src/components/stream_view.rs b/src/components/stream_view.rs index a1cb7b0..20ad81d 100644 --- a/src/components/stream_view.rs +++ b/src/components/stream_view.rs @@ -200,8 +200,8 @@ impl SteamView { let rows = self.items.iter().enumerate().map(|(i, data)| { let color = match i % 2 { - 0 => self.id_table.colors.normal_row_color, - _ => self.id_table.colors.alt_row_color, + 0 => self.id_table.colors.normal_row, + _ => self.id_table.colors.alt_row, }; let item = [&data.key]; @@ -222,7 +222,7 @@ impl SteamView { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.id_table.colors.buffer_bg) + .bg(self.id_table.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.id_table.state); } @@ -273,8 +273,8 @@ impl SteamView { if let Some(data) = self.items.get(i) { let rows = data.value.iter().enumerate().map(|(i, (field, value))| { let color = match i % 2 { - 0 => self.entry_table.colors.normal_row_color, - _ => self.entry_table.colors.alt_row_color, + 0 => self.entry_table.colors.normal_row, + _ => self.entry_table.colors.alt_row, }; let item; let height: u16; @@ -326,7 +326,7 @@ impl SteamView { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.entry_table.colors.buffer_bg) + .bg(self.entry_table.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.entry_table.state); } diff --git a/src/components/zset_table.rs b/src/components/zset_table.rs index d245b34..ebb2b5f 100644 --- a/src/components/zset_table.rs +++ b/src/components/zset_table.rs @@ -149,8 +149,8 @@ impl ZSetValue { let mut selected_height = 5; let rows = self.items.iter().enumerate().map(|(i, data)| { let color = match i % 2 { - 0 => self.colors.normal_row_color, - _ => self.colors.alt_row_color, + 0 => self.colors.normal_row, + _ => self.colors.alt_row, }; let item; let height: u16; @@ -202,7 +202,7 @@ impl ZSetValue { .header(header) .row_highlight_style(selected_style) .highlight_symbol(highlight_symbol) - .bg(self.colors.buffer_bg) + .bg(self.colors.bg) .highlight_spacing(HighlightSpacing::Always); frame.render_stateful_widget(t, area, &mut self.state); } diff --git a/src/context.rs b/src/context.rs index bd9d7ab..301b7ee 100644 --- a/src/context.rs +++ b/src/context.rs @@ -108,7 +108,7 @@ impl Context { fn render_fps(&self, frame: &mut Frame, area: Rect) -> Result<()> { frame.render_widget(Text::from(format!("{:.1}", self.fps)) - .style(Style::default().fg(get_color(|t| &t.context.fps_fg))), area); + .style(Style::default().fg(get_color(|t| &t.context.fps))), area); Ok(()) } @@ -141,7 +141,7 @@ impl Context { let mut command_text = Text::default(); let footers = self.footer_elements(); for (icon, desc) in footers { - let command_icon = Span::styled(format!(" {} ", icon), Style::default().bold().fg(Color::default()).bg(get_color(|t| &t.context.icon_bg))); + let command_icon = Span::styled(format!(" {} ", icon), Style::default().bold().fg(Color::default()).bg(get_color(|t| &t.context.key_bg))); let command_desc = Span::styled(format!(" {} ", desc), Style::default().bold()); command_text.push_span(command_icon); command_text.push_span(command_desc); diff --git a/src/tabs/cli.rs b/src/tabs/cli.rs index 9d31002..10e0d51 100644 --- a/src/tabs/cli.rs +++ b/src/tabs/cli.rs @@ -51,7 +51,7 @@ impl TabImplementation for CliTab { fn title(&self) -> Line<'static> { " CLI " - .fg(get_color(|t| &t.tab.title_fg)) + .fg(get_color(|t| &t.tab.title)) .bg(get_color(|t| &t.tab.cli.accent)) .into() } diff --git a/src/tabs/explorer.rs b/src/tabs/explorer.rs index e38a30f..926ac4a 100644 --- a/src/tabs/explorer.rs +++ b/src/tabs/explorer.rs @@ -983,7 +983,7 @@ impl TabImplementation for ExplorerTab { fn title(&self) -> Line<'static> { " Explorer " - .fg(get_color(|t| &t.tab.title_fg)) + .fg(get_color(|t| &t.tab.title)) .bg(get_color(|t| &t.tab.explorer.accent)) .into() } diff --git a/src/tabs/logger.rs b/src/tabs/logger.rs index 6df3bad..3b393c4 100644 --- a/src/tabs/logger.rs +++ b/src/tabs/logger.rs @@ -29,7 +29,7 @@ impl TabImplementation for LoggerTab { fn title(&self) -> Line<'static> { " Logger " - .fg(get_color(|t| &t.tab.title_fg)) + .fg(get_color(|t| &t.tab.title)) .bg(get_color(|t| &t.tab.logger.accent)) .into() } diff --git a/src/theme.rs b/src/theme.rs index a373c3e..7384d1d 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -51,8 +51,8 @@ impl Theme { theme.name = "ratisui-dark".to_string(); theme.kind = Kind::Dark; - theme.context.fps_fg = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C500); - theme.context.icon_bg = Color::Tailwind(TailwindColor::YELLOW, TailwindPalette::C700); + theme.context.fps = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C500); + theme.context.key_bg = Color::Tailwind(TailwindColor::YELLOW, TailwindPalette::C700); theme.server.highlight = Color::Default; theme.server.name = Color::Tailwind(TailwindColor::AMBER, TailwindPalette::C400); @@ -62,12 +62,12 @@ impl Theme { theme.server.tls = Color::Tailwind(TailwindColor::ROSE, TailwindPalette::C600); theme.server.protocol = Color::Tailwind(TailwindColor::EMERALD, TailwindPalette::C600); - theme.table.buffer_bg = Color::Default; + theme.table.bg = Color::Default; theme.table.header_bg = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C900); - theme.table.header_fg = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C200); - theme.table.row_fg = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C200); - theme.table.normal_row_color = Color::Default; - theme.table.alt_row_color = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C950); + theme.table.header = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C200); + theme.table.row = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C200); + theme.table.odd_row_bg = Color::Default; + theme.table.even_row_bg = Color::Tailwind(TailwindColor::GRAY, TailwindPalette::C950); theme.raw.string = Color::Tailwind(TailwindColor::AMBER, TailwindPalette::C400); theme.raw.boolean = Color::Tailwind(TailwindColor::ROSE, TailwindPalette::C600); @@ -88,7 +88,7 @@ impl Theme { theme.editor.editing = Color::Tailwind(TailwindColor::SKY, TailwindPalette::C700); theme.editor.warning = Color::Tailwind(TailwindColor::RED, TailwindPalette::C700); - theme.tab.title_fg = Color::Tailwind(TailwindColor::SLATE, TailwindPalette::C200); + theme.tab.title = Color::Tailwind(TailwindColor::SLATE, TailwindPalette::C200); theme.tab.explorer.accent = Color::Tailwind(TailwindColor::ROSE, TailwindPalette::C900); theme.tab.explorer.highlight = Color::Tailwind(TailwindColor::ROSE, TailwindPalette::C700); @@ -106,9 +106,9 @@ impl Theme { theme.tab.cli.highlight = Color::Tailwind(TailwindColor::GREEN, TailwindPalette::C700); theme.tab.cli.menu.bg = Color::Tailwind(TailwindColor::NEUTRAL, TailwindPalette::C800); theme.tab.cli.menu.highlight = Color::Tailwind(TailwindColor::ZINC, TailwindPalette::C900); - theme.tab.cli.menu.info = Color::Tailwind(TailwindColor::STONE, TailwindPalette::C900); - theme.tab.cli.menu.desc_bg = Color::Tailwind(TailwindColor::NEUTRAL, TailwindPalette::C800); + theme.tab.cli.menu.info_bg = Color::Tailwind(TailwindColor::STONE, TailwindPalette::C900); theme.tab.cli.menu.input = Color::Tailwind(TailwindColor::AMBER, TailwindPalette::C500); + theme.tab.cli.doc.bg = Color::Tailwind(TailwindColor::NEUTRAL, TailwindPalette::C800); theme.tab.cli.doc.command = Color::Tailwind(TailwindColor::AMBER, TailwindPalette::C400); theme.tab.cli.doc.attribute = Color::Tailwind(TailwindColor::PINK, TailwindPalette::C800); theme.tab.cli.console.cmd = Color::Tailwind(TailwindColor::EMERALD, TailwindPalette::C700); @@ -129,7 +129,7 @@ impl Theme { /// Theme configuration /// `~/.config/ratisui/theme/{name}.ron` -#[derive(Serialize, Deserialize, Default, Clone)] +#[derive(Serialize, Deserialize, Default, Clone, Debug)] #[serde(default)] pub struct Theme { pub name: String, @@ -146,7 +146,7 @@ pub struct Theme { /// Base theme kind, used for fallback #[derive(Serialize, Deserialize, Default, Clone, Debug)] -pub enum Kind { +pub enum Kind { Light, #[default] Dark, @@ -161,6 +161,44 @@ pub enum Color { Default, #[default] Fallback, + + /// ANSI Color: Black. Foreground: 30, Background: 40 + Black, + /// ANSI Color: Red. Foreground: 31, Background: 41 + Red, + /// ANSI Color: Green. Foreground: 32, Background: 42 + Green, + /// ANSI Color: Yellow. Foreground: 33, Background: 43 + Yellow, + /// ANSI Color: Blue. Foreground: 34, Background: 44 + Blue, + /// ANSI Color: Magenta. Foreground: 35, Background: 45 + Magenta, + /// ANSI Color: Cyan. Foreground: 36, Background: 46 + Cyan, + /// ANSI Color: White. Foreground: 37, Background: 47 + /// + /// Note that this is sometimes called `silver` or `white` but we use `white` for bright white + Gray, + /// ANSI Color: Bright Black. Foreground: 90, Background: 100 + /// + /// Note that this is sometimes called `light black` or `bright black` but we use `dark gray` + DarkGray, + /// ANSI Color: Bright Red. Foreground: 91, Background: 101 + LightRed, + /// ANSI Color: Bright Green. Foreground: 92, Background: 102 + LightGreen, + /// ANSI Color: Bright Yellow. Foreground: 93, Background: 103 + LightYellow, + /// ANSI Color: Bright Blue. Foreground: 94, Background: 104 + LightBlue, + /// ANSI Color: Bright Magenta. Foreground: 95, Background: 105 + LightMagenta, + /// ANSI Color: Bright Cyan. Foreground: 96, Background: 106 + LightCyan, + /// ANSI Color: Bright White. Foreground: 97, Background: 107 + /// Sometimes called `bright white` or `light white` in some terminals + White, } /// Tailwind colors @@ -211,8 +249,8 @@ pub enum TailwindPalette { #[derive(Serialize, Deserialize, Default, Clone, Debug)] #[serde(default)] pub struct Context { - pub fps_fg: Color, - pub icon_bg: Color, + pub fps: Color, + pub key_bg: Color, } #[derive(Serialize, Deserialize, Default, Clone, Debug)] @@ -230,12 +268,12 @@ pub struct Server { #[derive(Serialize, Deserialize, Default, Clone, Debug)] #[serde(default)] pub struct Table { - pub buffer_bg: Color, + pub bg: Color, pub header_bg: Color, - pub header_fg: Color, - pub row_fg: Color, - pub normal_row_color: Color, - pub alt_row_color: Color, + pub header: Color, + pub row: Color, + pub odd_row_bg: Color, + pub even_row_bg: Color, } #[derive(Serialize, Deserialize, Default, Clone, Debug)] @@ -270,7 +308,7 @@ pub struct Editor { #[derive(Serialize, Deserialize, Default, Clone, Debug)] #[serde(default)] pub struct Tab { - pub title_fg: Color, + pub title: Color, pub explorer: Explorer, pub cli: Cli, pub logger: Logger, @@ -327,14 +365,14 @@ pub struct Console { pub struct Menu { pub bg: Color, pub highlight: Color, - pub info: Color, - pub desc_bg: Color, + pub info_bg: Color, pub input: Color, } #[derive(Serialize, Deserialize, Default, Clone, Debug)] #[serde(default)] pub struct Doc { + pub bg: Color, pub command: Color, pub attribute: Color, } @@ -411,22 +449,30 @@ impl Color { TailwindPalette::C950 => color.c950, }) } - Color::Hex(hex) => { - if let Ok(in_u32) = u32::from_str_radix(&hex, 16) { - Some(RColor::from_u32(in_u32)) - } else { - None - } - } - Color::Rgb(r, g, b) => { - Some(RColor::Rgb(*r, *g, *b)) - } - Color::Default => { - Some(RColor::default()) - } - Color::Fallback => { + Color::Hex(hex) => if let Ok(in_u32) = u32::from_str_radix(&hex, 16) { + Some(RColor::from_u32(in_u32)) + } else { None - } + }, + Color::Rgb(r, g, b) => Some(RColor::Rgb(*r, *g, *b)), + Color::Default => Some(RColor::default()), + Color::Fallback => None, + Color::Black => Some(RColor::Black), + Color::Red => Some(RColor::Red), + Color::Green => Some(RColor::Green), + Color::Yellow => Some(RColor::Yellow), + Color::Blue => Some(RColor::Blue), + Color::Magenta => Some(RColor::Magenta), + Color::Cyan => Some(RColor::Cyan), + Color::Gray => Some(RColor::Gray), + Color::DarkGray => Some(RColor::DarkGray), + Color::LightRed => Some(RColor::LightRed), + Color::LightGreen => Some(RColor::LightGreen), + Color::LightYellow => Some(RColor::LightYellow), + Color::LightBlue => Some(RColor::LightBlue), + Color::LightMagenta => Some(RColor::LightMagenta), + Color::LightCyan => Some(RColor::LightCyan), + Color::White => Some(RColor::White), } } }