Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose "reset" color value in themes #8075

Closed
chtenb opened this issue Aug 27, 2023 · 1 comment · Fixed by #8083
Closed

Expose "reset" color value in themes #8075

chtenb opened this issue Aug 27, 2023 · 1 comment · Fixed by #8083
Labels
A-theme Area: Theme and appearence related C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@chtenb
Copy link
Contributor

chtenb commented Aug 27, 2023

The Color struct has a Reset value, which should reset the color to the default terminal foreground or background. But this doesn't seem to be exposed to be used in themes, as far as I could find anyway.

Being able to access the default fg/bg colors in a theme is useful, because they may differ from the 16 colors/256 colors in the terminal color palette. In curses, the default color can be called with the number -1, while the colors are called with numbers 0..255. I have no preference if helix should expose it like this or rather something else.

@chtenb chtenb added the C-enhancement Category: Improvements label Aug 27, 2023
@the-mikedavis the-mikedavis added the A-theme Area: Theme and appearence related label Aug 27, 2023
@the-mikedavis
Copy link
Member

the-mikedavis commented Aug 27, 2023

I believe we just need to add reset.to_string() => Color::Reset to the default palette:

impl Default for ThemePalette {
fn default() -> Self {
Self {
palette: hashmap! {
"black".to_string() => Color::Black,
"red".to_string() => Color::Red,
"green".to_string() => Color::Green,
"yellow".to_string() => Color::Yellow,
"blue".to_string() => Color::Blue,
"magenta".to_string() => Color::Magenta,
"cyan".to_string() => Color::Cyan,
"gray".to_string() => Color::Gray,
"light-red".to_string() => Color::LightRed,
"light-green".to_string() => Color::LightGreen,
"light-yellow".to_string() => Color::LightYellow,
"light-blue".to_string() => Color::LightBlue,
"light-magenta".to_string() => Color::LightMagenta,
"light-cyan".to_string() => Color::LightCyan,
"light-gray".to_string() => Color::LightGray,
"white".to_string() => Color::White,
},
}
}
}

(plus add it to the theme docs)

@the-mikedavis the-mikedavis added E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR labels Aug 27, 2023
@the-mikedavis the-mikedavis linked a pull request Aug 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-theme Area: Theme and appearence related C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants