add color config for char select

Signed-off-by: Ye Sijun <junnplus@gmail.com>
This commit is contained in:
Ye Sijun authored and Wez Furlong committed 2023-05-28 09:01:22 -07:00
1 parent 30ef02ff56
commit 95ab807aab
6 files changed
+58 -7

No files matched your search

+14
View File
@@ -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
}
@@ -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).
@@ -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).
@@ -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).
@@ -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)
+7 -7
View File
@@ -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),