From 95ab807aab82e3ae2ede4abc0ca37cb5d325e958 Mon Sep 17 00:00:00 2001 From: Ye Sijun Date: Tue, 9 May 2023 14:01:22 +0900 Subject: [PATCH] add color config for char select Signed-off-by: Ye Sijun --- config/src/config.rs | 14 ++++++++++++++ docs/config/lua/config/char_select_bg_color.md | 11 +++++++++++ docs/config/lua/config/char_select_fg_color.md | 11 +++++++++++ docs/config/lua/config/char_select_font_size.md | 11 +++++++++++ docs/config/lua/keyassignment/CharSelect.md | 4 ++++ wezterm-gui/src/termwindow/charselect.rs | 14 +++++++------- 6 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 docs/config/lua/config/char_select_bg_color.md create mode 100644 docs/config/lua/config/char_select_fg_color.md create mode 100644 docs/config/lua/config/char_select_font_size.md diff --git a/config/src/config.rs b/config/src/config.rs index edadc96e9..4f1e0232b 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -136,6 +136,12 @@ pub struct Config { #[dynamic(default = "default_char_select_font_size")] pub char_select_font_size: f64, + #[dynamic(default = "default_char_select_fg_color")] + pub char_select_fg_color: RgbaColor, + + #[dynamic(default = "default_char_select_bg_color")] + pub char_select_bg_color: RgbaColor, + #[dynamic(default = "default_command_palette_font_size")] pub command_palette_font_size: f64, @@ -1535,6 +1541,14 @@ fn default_char_select_font_size() -> f64 { 18.0 } +fn default_char_select_fg_color() -> RgbaColor { + SrgbaTuple(0.75, 0.75, 0.75, 1.0).into() +} + +fn default_char_select_bg_color() -> RgbaColor { + (0x33, 0x33, 0x33).into() +} + fn default_command_palette_font_size() -> f64 { 14.0 } diff --git a/docs/config/lua/config/char_select_bg_color.md b/docs/config/lua/config/char_select_bg_color.md new file mode 100644 index 000000000..6b2b1fdeb --- /dev/null +++ b/docs/config/lua/config/char_select_bg_color.md @@ -0,0 +1,11 @@ +--- +tags: + - color + - char_select +--- +# `char_select_bg_color = "#333333"` + +*Since: nightly builds only* + +Specifies the background color used by +[CharSelect](../keyassignment/CharSelect.md). diff --git a/docs/config/lua/config/char_select_fg_color.md b/docs/config/lua/config/char_select_fg_color.md new file mode 100644 index 000000000..d890aa966 --- /dev/null +++ b/docs/config/lua/config/char_select_fg_color.md @@ -0,0 +1,11 @@ +--- +tags: + - color + - char_select +--- +# `char_select_fg_color = rgba(0.75, 0.75, 0.75, 1.0)` + +*Since: nightly builds only* + +Specifies the text color used by +[CharSelect](../keyassignment/CharSelect.md). diff --git a/docs/config/lua/config/char_select_font_size.md b/docs/config/lua/config/char_select_font_size.md new file mode 100644 index 000000000..dcc61d2a9 --- /dev/null +++ b/docs/config/lua/config/char_select_font_size.md @@ -0,0 +1,11 @@ +--- +tags: + - font + - char_select +--- +# `char_select_font_size = 14.0` + +*Since: nightly builds only* + +Specifies the size of the font used with +[CharSelect](../keyassignment/CharSelect.md). diff --git a/docs/config/lua/keyassignment/CharSelect.md b/docs/config/lua/keyassignment/CharSelect.md index 3b9225a93..630be9dae 100644 --- a/docs/config/lua/keyassignment/CharSelect.md +++ b/docs/config/lua/keyassignment/CharSelect.md @@ -72,3 +72,7 @@ The `CharSelect` action accepts a lua table with the following fields: `"RecentlyUsed"` if you have previously selected an item, or `"SmileysAndEmotion"` otherwise. +See also: +* [char_select_font_size](../config/char_select_font_size.md) +* [char_select_fg_color](../config/char_select_fg_color.md) +* [char_select_bg_color](../config/char_select_bg_color.md) diff --git a/wezterm-gui/src/termwindow/charselect.rs b/wezterm-gui/src/termwindow/charselect.rs index f1053207a..3dc53ab8f 100644 --- a/wezterm-gui/src/termwindow/charselect.rs +++ b/wezterm-gui/src/termwindow/charselect.rs @@ -387,7 +387,7 @@ impl CharSelector { .colors(ElementColors { border: BorderColor::default(), bg: LinearRgba::TRANSPARENT.into(), - text: term_window.config.pane_select_fg_color.to_linear().into(), + text: term_window.config.char_select_fg_color.to_linear().into(), }) .display(DisplayType::Block)]; @@ -401,13 +401,13 @@ impl CharSelector { { let (bg, text) = if display_idx == selected_row { ( - term_window.config.pane_select_fg_color.to_linear().into(), - term_window.config.pane_select_bg_color.to_linear().into(), + term_window.config.char_select_fg_color.to_linear().into(), + term_window.config.char_select_bg_color.to_linear().into(), ) } else { ( LinearRgba::TRANSPARENT.into(), - term_window.config.pane_select_fg_color.to_linear().into(), + term_window.config.char_select_fg_color.to_linear().into(), ) }; elements.push( @@ -438,10 +438,10 @@ impl CharSelector { let element = Element::new(&font, ElementContent::Children(elements)) .colors(ElementColors { border: BorderColor::new( - term_window.config.pane_select_bg_color.to_linear().into(), + term_window.config.char_select_bg_color.to_linear().into(), ), - bg: term_window.config.pane_select_bg_color.to_linear().into(), - text: term_window.config.pane_select_fg_color.to_linear().into(), + bg: term_window.config.char_select_bg_color.to_linear().into(), + text: term_window.config.char_select_fg_color.to_linear().into(), }) .margin(BoxDimension { left: Dimension::Cells(1.25),