Emit accurate hex colors in generated themes (#3547)

This PR fixes an issues where the hex colors in the generated themes
were not correct.

We're using the [`palette`](https://crates.io/crates/palette) crate to
perform the conversions, as this gives us accurate hex codes that match
the VS Code source themes.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-07 18:34:03 -05:00 committed by GitHub
parent 0b78a401de
commit c7e19c0bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 974 additions and 871 deletions

View file

@ -1,5 +1,5 @@
use anyhow::Result;
use gpui::{rgba, Hsla, Rgba};
use gpui::rgba;
use indexmap::IndexMap;
use strum::IntoEnumIterator;
use theme::{
@ -7,16 +7,13 @@ use theme::{
UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement,
};
use crate::color::try_parse_color;
use crate::util::Traverse;
use crate::vscode::VsCodeTheme;
use crate::ThemeMetadata;
use super::ZedSyntaxToken;
pub(crate) fn try_parse_color(color: &str) -> Result<Hsla> {
Ok(Rgba::try_from(color)?.into())
}
pub(crate) fn try_parse_font_weight(font_style: &str) -> Option<UserFontWeight> {
match font_style {
style if style.contains("bold") => Some(UserFontWeight::BOLD),