Pull syntax colors from JSON theme
This commit is contained in:
@@ -37,29 +37,45 @@ pub fn one_dark() -> Theme {
|
||||
icon_muted: rgba(0x838994ff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("link_text".into(), rgba(0x73ade9ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb1574bff).into()),
|
||||
("enum".into(), rgba(0xd07277ff).into()),
|
||||
("text.literal".into(), rgba(0xa1c181ff).into()),
|
||||
("string".into(), rgba(0xa1c181ff).into()),
|
||||
("operator".into(), rgba(0x6eb4bfff).into()),
|
||||
("constructor".into(), rgba(0x73ade9ff).into()),
|
||||
("emphasis.strong".into(), rgba(0xbf956aff).into()),
|
||||
("comment".into(), rgba(0x5d636fff).into()),
|
||||
("function".into(), rgba(0x73ade9ff).into()),
|
||||
("link_uri".into(), rgba(0x6eb4bfff).into()),
|
||||
("number".into(), rgba(0xbf956aff).into()),
|
||||
("property".into(), rgba(0xd07277ff).into()),
|
||||
("variable.special".into(), rgba(0xbf956aff).into()),
|
||||
("primary".into(), rgba(0xacb2beff).into()),
|
||||
("boolean".into(), rgba(0xbf956aff).into()),
|
||||
("label".into(), rgba(0x74ade8ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd07277ff).into()),
|
||||
("keyword".into(), rgba(0xb477cfff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xb2b9c6ff).into()),
|
||||
("string.special".into(), rgba(0xbf956aff).into()),
|
||||
("constant".into(), rgba(0xdfc184ff).into()),
|
||||
("punctuation".into(), rgba(0xacb2beff).into()),
|
||||
("variable.special".into(), rgba(0xbf956aff).into()),
|
||||
("preproc".into(), rgba(0xc8ccd4ff).into()),
|
||||
("enum".into(), rgba(0xd07277ff).into()),
|
||||
("attribute".into(), rgba(0x74ade8ff).into()),
|
||||
("emphasis.strong".into(), rgba(0xbf956aff).into()),
|
||||
("title".into(), rgba(0xd07277ff).into()),
|
||||
("hint".into(), rgba(0x5a6f89ff).into()),
|
||||
("emphasis".into(), rgba(0x74ade8ff).into()),
|
||||
("string.regex".into(), rgba(0xbf956aff).into()),
|
||||
("link_text".into(), rgba(0x73ade9ff).into()),
|
||||
("string".into(), rgba(0xa1c181ff).into()),
|
||||
("comment.doc".into(), rgba(0x878e98ff).into()),
|
||||
("punctuation.special".into(), rgba(0xb1574bff).into()),
|
||||
("primary".into(), rgba(0xacb2beff).into()),
|
||||
("operator".into(), rgba(0x6eb4bfff).into()),
|
||||
("function".into(), rgba(0x73ade9ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xbf956aff).into()),
|
||||
("type".into(), rgba(0x6eb4bfff).into()),
|
||||
("variant".into(), rgba(0x73ade9ff).into()),
|
||||
("constant".into(), rgba(0xdfc184ff).into()),
|
||||
("title".into(), rgba(0xd07277ff).into()),
|
||||
("boolean".into(), rgba(0xbf956aff).into()),
|
||||
("keyword".into(), rgba(0xb477cfff).into()),
|
||||
("link_uri".into(), rgba(0x6eb4bfff).into()),
|
||||
("tag".into(), rgba(0x74ade8ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xb2b9c6ff).into()),
|
||||
("embedded".into(), rgba(0xc8ccd4ff).into()),
|
||||
("string.escape".into(), rgba(0x878e98ff).into()),
|
||||
("variable".into(), rgba(0xc8ccd4ff).into()),
|
||||
("predictive".into(), rgba(0x5a6a87ff).into()),
|
||||
("comment".into(), rgba(0x5d636fff).into()),
|
||||
("text.literal".into(), rgba(0xa1c181ff).into()),
|
||||
("constructor".into(), rgba(0x73ade9ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x3b414dff).into(),
|
||||
|
||||
@@ -37,21 +37,46 @@ pub fn rose_pine() -> Theme {
|
||||
icon_muted: rgba(0x74708dff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("function.method".into(), rgba(0xebbcbaff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("operator".into(), rgba(0x30738fff).into()),
|
||||
("text.literal".into(), rgba(0xc4a7e6ff).into()),
|
||||
("string".into(), rgba(0xf5c177ff).into()),
|
||||
("enum".into(), rgba(0xc4a7e6ff).into()),
|
||||
("number".into(), rgba(0x5cc1a3ff).into()),
|
||||
("attribute".into(), rgba(0x9bced6ff).into()),
|
||||
("property".into(), rgba(0x9bced6ff).into()),
|
||||
("function".into(), rgba(0xebbcbaff).into()),
|
||||
("embedded".into(), rgba(0xe0def4ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x9d99b6ff).into()),
|
||||
("variant".into(), rgba(0x9bced6ff).into()),
|
||||
("operator".into(), rgba(0x30738fff).into()),
|
||||
("comment".into(), rgba(0x6e6a86ff).into()),
|
||||
("keyword".into(), rgba(0x30738fff).into()),
|
||||
("boolean".into(), rgba(0xebbcbaff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("label".into(), rgba(0x9bced6ff).into()),
|
||||
("string.escape".into(), rgba(0x76728fff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("constructor".into(), rgba(0x9bced6ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x9d99b6ff).into()),
|
||||
("function.method".into(), rgba(0xebbcbaff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("link_text".into(), rgba(0x9ccfd8ff).into()),
|
||||
("string.special".into(), rgba(0xc4a7e6ff).into()),
|
||||
("string.regex".into(), rgba(0xc4a7e6ff).into()),
|
||||
("preproc".into(), rgba(0xe0def4ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x9bced6ff).into()),
|
||||
("emphasis".into(), rgba(0x9bced6ff).into()),
|
||||
("comment.doc".into(), rgba(0x76728fff).into()),
|
||||
("boolean".into(), rgba(0xebbcbaff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x9d99b6ff).into()),
|
||||
("hint".into(), rgba(0x5e768cff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xc4a7e6ff).into()),
|
||||
("primary".into(), rgba(0xe0def4ff).into()),
|
||||
("predictive".into(), rgba(0x556b81ff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("constant".into(), rgba(0x5cc1a3ff).into()),
|
||||
("punctuation.special".into(), rgba(0x9d99b6ff).into()),
|
||||
("link_uri".into(), rgba(0xebbcbaff).into()),
|
||||
("keyword".into(), rgba(0x30738fff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x292738ff).into(),
|
||||
@@ -141,21 +166,46 @@ pub fn rose_pine_dawn() -> Theme {
|
||||
icon_muted: rgba(0x706c8cff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("link_text".into(), rgba(0x55949fff).into()),
|
||||
("punctuation".into(), rgba(0x797593ff).into()),
|
||||
("string".into(), rgba(0xea9d34ff).into()),
|
||||
("variable".into(), rgba(0x575279ff).into()),
|
||||
("type".into(), rgba(0x55949fff).into()),
|
||||
("comment".into(), rgba(0x9893a5ff).into()),
|
||||
("boolean".into(), rgba(0xd7827dff).into()),
|
||||
("function.method".into(), rgba(0xd7827dff).into()),
|
||||
("operator".into(), rgba(0x276983ff).into()),
|
||||
("function".into(), rgba(0xd7827dff).into()),
|
||||
("keyword".into(), rgba(0x276983ff).into()),
|
||||
("link_text".into(), rgba(0x55949fff).into()),
|
||||
("embedded".into(), rgba(0x575279ff).into()),
|
||||
("type.builtin".into(), rgba(0x55949fff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0x635e82ff).into()),
|
||||
("text.literal".into(), rgba(0x9079a9ff).into()),
|
||||
("variant".into(), rgba(0x57949fff).into()),
|
||||
("string".into(), rgba(0xea9d34ff).into()),
|
||||
("hint".into(), rgba(0x7a92aaff).into()),
|
||||
("punctuation.special".into(), rgba(0x635e82ff).into()),
|
||||
("string.special".into(), rgba(0x9079a9ff).into()),
|
||||
("string.regex".into(), rgba(0x9079a9ff).into()),
|
||||
("operator".into(), rgba(0x276983ff).into()),
|
||||
("boolean".into(), rgba(0xd7827dff).into()),
|
||||
("constructor".into(), rgba(0x57949fff).into()),
|
||||
("punctuation".into(), rgba(0x797593ff).into()),
|
||||
("label".into(), rgba(0x57949fff).into()),
|
||||
("variable".into(), rgba(0x575279ff).into()),
|
||||
("tag".into(), rgba(0x55949fff).into()),
|
||||
("title".into(), rgba(0xea9d34ff).into()),
|
||||
("primary".into(), rgba(0x575279ff).into()),
|
||||
("link_uri".into(), rgba(0xd7827dff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0x635e82ff).into()),
|
||||
("string.escape".into(), rgba(0x6e6a8bff).into()),
|
||||
("punctuation.bracket".into(), rgba(0x635e82ff).into()),
|
||||
("function".into(), rgba(0xd7827dff).into()),
|
||||
("preproc".into(), rgba(0x575279ff).into()),
|
||||
("function.method".into(), rgba(0xd7827dff).into()),
|
||||
("predictive".into(), rgba(0xa2acbeff).into()),
|
||||
("comment.doc".into(), rgba(0x6e6a8bff).into()),
|
||||
("comment".into(), rgba(0x9893a5ff).into()),
|
||||
("number".into(), rgba(0x3daa8eff).into()),
|
||||
("emphasis".into(), rgba(0x57949fff).into()),
|
||||
("title".into(), rgba(0xea9d34ff).into()),
|
||||
("enum".into(), rgba(0x9079a9ff).into()),
|
||||
("string.special.symbol".into(), rgba(0x9079a9ff).into()),
|
||||
("constant".into(), rgba(0x3daa8eff).into()),
|
||||
("emphasis.strong".into(), rgba(0x57949fff).into()),
|
||||
("property".into(), rgba(0x57949fff).into()),
|
||||
("attribute".into(), rgba(0x57949fff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0xdcd8d8ff).into(),
|
||||
@@ -245,21 +295,46 @@ pub fn rose_pine_moon() -> Theme {
|
||||
icon_muted: rgba(0x85819eff).into(),
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("keyword".into(), rgba(0x3d8fb0ff).into()),
|
||||
("boolean".into(), rgba(0xea9a97ff).into()),
|
||||
("function".into(), rgba(0xea9a97ff).into()),
|
||||
("comment".into(), rgba(0x6e6a86ff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("link_text".into(), rgba(0x9ccfd8ff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("function.method".into(), rgba(0xea9a97ff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("operator".into(), rgba(0x3d8fb0ff).into()),
|
||||
("string".into(), rgba(0xf5c177ff).into()),
|
||||
("embedded".into(), rgba(0xe0def4ff).into()),
|
||||
("link_uri".into(), rgba(0xea9a97ff).into()),
|
||||
("primary".into(), rgba(0xe0def4ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xaeabc6ff).into()),
|
||||
("string.escape".into(), rgba(0x8682a0ff).into()),
|
||||
("attribute".into(), rgba(0x9bced6ff).into()),
|
||||
("constant".into(), rgba(0x5cc1a3ff).into()),
|
||||
("keyword".into(), rgba(0x3d8fb0ff).into()),
|
||||
("predictive".into(), rgba(0x516b83ff).into()),
|
||||
("label".into(), rgba(0x9bced6ff).into()),
|
||||
("comment.doc".into(), rgba(0x8682a0ff).into()),
|
||||
("emphasis".into(), rgba(0x9bced6ff).into()),
|
||||
("string".into(), rgba(0xf5c177ff).into()),
|
||||
("type".into(), rgba(0x9ccfd8ff).into()),
|
||||
("string.special".into(), rgba(0xc4a7e6ff).into()),
|
||||
("function".into(), rgba(0xea9a97ff).into()),
|
||||
("constructor".into(), rgba(0x9bced6ff).into()),
|
||||
("comment".into(), rgba(0x6e6a86ff).into()),
|
||||
("preproc".into(), rgba(0xe0def4ff).into()),
|
||||
("enum".into(), rgba(0xc4a7e6ff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xaeabc6ff).into()),
|
||||
("number".into(), rgba(0x5cc1a3ff).into()),
|
||||
("hint".into(), rgba(0x728aa2ff).into()),
|
||||
("variant".into(), rgba(0x9bced6ff).into()),
|
||||
("link_text".into(), rgba(0x9ccfd8ff).into()),
|
||||
("property".into(), rgba(0x9bced6ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xaeabc6ff).into()),
|
||||
("operator".into(), rgba(0x3d8fb0ff).into()),
|
||||
("title".into(), rgba(0xf5c177ff).into()),
|
||||
("punctuation".into(), rgba(0x908caaff).into()),
|
||||
("string.regex".into(), rgba(0xc4a7e6ff).into()),
|
||||
("tag".into(), rgba(0x9ccfd8ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x9bced6ff).into()),
|
||||
("text.literal".into(), rgba(0xc4a7e6ff).into()),
|
||||
("punctuation.special".into(), rgba(0xaeabc6ff).into()),
|
||||
("boolean".into(), rgba(0xea9a97ff).into()),
|
||||
("type.builtin".into(), rgba(0x9ccfd8ff).into()),
|
||||
("function.method".into(), rgba(0xea9a97ff).into()),
|
||||
("variable".into(), rgba(0xe0def4ff).into()),
|
||||
("string.special.symbol".into(), rgba(0xc4a7e6ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x38354eff).into(),
|
||||
|
||||
@@ -35,7 +35,48 @@ pub fn sandcastle() -> Theme {
|
||||
text_disabled: rgba(0x827568ff).into(),
|
||||
text_accent: rgba(0x518b8bff).into(),
|
||||
icon_muted: rgba(0xa69782ff).into(),
|
||||
syntax: SyntaxTheme { highlights: vec![] },
|
||||
syntax: SyntaxTheme {
|
||||
highlights: vec![
|
||||
("string.special.symbol".into(), rgba(0xa07d3aff).into()),
|
||||
("enum".into(), rgba(0xa07d3aff).into()),
|
||||
("punctuation.bracket".into(), rgba(0xd5c5a1ff).into()),
|
||||
("hint".into(), rgba(0x727d68ff).into()),
|
||||
("punctuation.delimiter".into(), rgba(0xd5c5a1ff).into()),
|
||||
("comment".into(), rgba(0xa89984ff).into()),
|
||||
("embedded".into(), rgba(0xfdf4c1ff).into()),
|
||||
("string".into(), rgba(0xa07d3aff).into()),
|
||||
("string.escape".into(), rgba(0xa89984ff).into()),
|
||||
("comment.doc".into(), rgba(0xa89984ff).into()),
|
||||
("variant".into(), rgba(0x518b8bff).into()),
|
||||
("predictive".into(), rgba(0x5c6152ff).into()),
|
||||
("link_text".into(), rgba(0xa07d3aff).into()),
|
||||
("attribute".into(), rgba(0x518b8bff).into()),
|
||||
("title".into(), rgba(0xfdf4c1ff).into()),
|
||||
("emphasis.strong".into(), rgba(0x518b8bff).into()),
|
||||
("primary".into(), rgba(0xfdf4c1ff).into()),
|
||||
("punctuation.list_marker".into(), rgba(0xd5c5a1ff).into()),
|
||||
("boolean".into(), rgba(0x83a598ff).into()),
|
||||
("function".into(), rgba(0xa07d3aff).into()),
|
||||
("punctuation.special".into(), rgba(0xd5c5a1ff).into()),
|
||||
("string.special".into(), rgba(0xa07d3aff).into()),
|
||||
("string.regex".into(), rgba(0xa07d3aff).into()),
|
||||
("tag".into(), rgba(0x518b8bff).into()),
|
||||
("keyword".into(), rgba(0x518b8bff).into()),
|
||||
("type".into(), rgba(0x83a598ff).into()),
|
||||
("text.literal".into(), rgba(0xa07d3aff).into()),
|
||||
("link_uri".into(), rgba(0x83a598ff).into()),
|
||||
("label".into(), rgba(0x518b8bff).into()),
|
||||
("property".into(), rgba(0x518b8bff).into()),
|
||||
("number".into(), rgba(0x83a598ff).into()),
|
||||
("constructor".into(), rgba(0x518b8bff).into()),
|
||||
("preproc".into(), rgba(0xfdf4c1ff).into()),
|
||||
("emphasis".into(), rgba(0x518b8bff).into()),
|
||||
("variable".into(), rgba(0xfdf4c1ff).into()),
|
||||
("operator".into(), rgba(0xa07d3aff).into()),
|
||||
("punctuation".into(), rgba(0xd5c5a1ff).into()),
|
||||
("constant".into(), rgba(0x83a598ff).into()),
|
||||
],
|
||||
},
|
||||
status_bar: rgba(0x333944ff).into(),
|
||||
title_bar: rgba(0x333944ff).into(),
|
||||
toolbar: rgba(0x282c33ff).into(),
|
||||
|
||||
@@ -24,9 +24,9 @@ fn main() -> Result<()> {
|
||||
|
||||
let args = Args::parse();
|
||||
|
||||
let legacy_theme = load_theme(args.theme)?;
|
||||
let (json_theme, legacy_theme) = load_theme(args.theme)?;
|
||||
|
||||
let theme = convert_theme(legacy_theme)?;
|
||||
let theme = convert_theme(json_theme, legacy_theme)?;
|
||||
|
||||
println!("{:#?}", ThemePrinter(theme));
|
||||
|
||||
@@ -89,76 +89,77 @@ impl From<PlayerThemeColors> for PlayerTheme {
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_theme(theme: LegacyTheme) -> Result<theme2::Theme> {
|
||||
fn convert_theme(json_theme: JsonTheme, legacy_theme: LegacyTheme) -> Result<theme2::Theme> {
|
||||
let transparent = hsla(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
let players: [PlayerTheme; 8] = [
|
||||
PlayerThemeColors::new(&theme, 0).into(),
|
||||
PlayerThemeColors::new(&theme, 1).into(),
|
||||
PlayerThemeColors::new(&theme, 2).into(),
|
||||
PlayerThemeColors::new(&theme, 3).into(),
|
||||
PlayerThemeColors::new(&theme, 4).into(),
|
||||
PlayerThemeColors::new(&theme, 5).into(),
|
||||
PlayerThemeColors::new(&theme, 6).into(),
|
||||
PlayerThemeColors::new(&theme, 7).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 0).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 1).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 2).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 3).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 4).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 5).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 6).into(),
|
||||
PlayerThemeColors::new(&legacy_theme, 7).into(),
|
||||
];
|
||||
|
||||
let theme = theme2::Theme {
|
||||
metadata: theme2::ThemeMetadata {
|
||||
name: theme.name.clone().into(),
|
||||
is_light: theme.is_light,
|
||||
name: legacy_theme.name.clone().into(),
|
||||
is_light: legacy_theme.is_light,
|
||||
},
|
||||
transparent,
|
||||
mac_os_traffic_light_red: rgb::<Hsla>(0xEC695E),
|
||||
mac_os_traffic_light_yellow: rgb::<Hsla>(0xF4BF4F),
|
||||
mac_os_traffic_light_green: rgb::<Hsla>(0x62C554),
|
||||
border: theme.lowest.base.default.border,
|
||||
border_variant: theme.lowest.variant.default.border,
|
||||
border_focused: theme.lowest.accent.default.border,
|
||||
border: legacy_theme.lowest.base.default.border,
|
||||
border_variant: legacy_theme.lowest.variant.default.border,
|
||||
border_focused: legacy_theme.lowest.accent.default.border,
|
||||
border_transparent: transparent,
|
||||
elevated_surface: theme.lowest.base.default.background,
|
||||
surface: theme.middle.base.default.background,
|
||||
background: theme.lowest.base.default.background,
|
||||
filled_element: theme.lowest.base.default.background,
|
||||
elevated_surface: legacy_theme.lowest.base.default.background,
|
||||
surface: legacy_theme.middle.base.default.background,
|
||||
background: legacy_theme.lowest.base.default.background,
|
||||
filled_element: legacy_theme.lowest.base.default.background,
|
||||
filled_element_hover: hsla(0.0, 0.0, 100.0, 0.12),
|
||||
filled_element_active: hsla(0.0, 0.0, 100.0, 0.16),
|
||||
filled_element_selected: theme.lowest.accent.default.background,
|
||||
filled_element_selected: legacy_theme.lowest.accent.default.background,
|
||||
filled_element_disabled: transparent,
|
||||
ghost_element: transparent,
|
||||
ghost_element_hover: hsla(0.0, 0.0, 100.0, 0.08),
|
||||
ghost_element_active: hsla(0.0, 0.0, 100.0, 0.12),
|
||||
ghost_element_selected: theme.lowest.accent.default.background,
|
||||
ghost_element_selected: legacy_theme.lowest.accent.default.background,
|
||||
ghost_element_disabled: transparent,
|
||||
text: theme.lowest.base.default.foreground,
|
||||
text_muted: theme.lowest.variant.default.foreground,
|
||||
text: legacy_theme.lowest.base.default.foreground,
|
||||
text_muted: legacy_theme.lowest.variant.default.foreground,
|
||||
/// TODO: map this to a real value
|
||||
text_placeholder: theme.lowest.negative.default.foreground,
|
||||
text_disabled: theme.lowest.base.disabled.foreground,
|
||||
text_accent: theme.lowest.accent.default.foreground,
|
||||
icon_muted: theme.lowest.variant.default.foreground,
|
||||
text_placeholder: legacy_theme.lowest.negative.default.foreground,
|
||||
text_disabled: legacy_theme.lowest.base.disabled.foreground,
|
||||
text_accent: legacy_theme.lowest.accent.default.foreground,
|
||||
icon_muted: legacy_theme.lowest.variant.default.foreground,
|
||||
syntax: SyntaxTheme {
|
||||
highlights: theme
|
||||
highlights: json_theme
|
||||
.editor
|
||||
.syntax
|
||||
.iter()
|
||||
.map(|(token, color)| (token.clone(), color.clone().into()))
|
||||
.map(|(token, style)| (token.clone(), style.color.clone().into()))
|
||||
.collect(),
|
||||
},
|
||||
status_bar: theme.lowest.base.default.background,
|
||||
title_bar: theme.lowest.base.default.background,
|
||||
toolbar: theme.highest.base.default.background,
|
||||
tab_bar: theme.middle.base.default.background,
|
||||
editor: theme.highest.base.default.background,
|
||||
editor_subheader: theme.middle.base.default.background,
|
||||
terminal: theme.highest.base.default.background,
|
||||
editor_active_line: theme.highest.on.default.background,
|
||||
image_fallback_background: theme.lowest.base.default.background,
|
||||
status_bar: legacy_theme.lowest.base.default.background,
|
||||
title_bar: legacy_theme.lowest.base.default.background,
|
||||
toolbar: legacy_theme.highest.base.default.background,
|
||||
tab_bar: legacy_theme.middle.base.default.background,
|
||||
editor: legacy_theme.highest.base.default.background,
|
||||
editor_subheader: legacy_theme.middle.base.default.background,
|
||||
terminal: legacy_theme.highest.base.default.background,
|
||||
editor_active_line: legacy_theme.highest.on.default.background,
|
||||
image_fallback_background: legacy_theme.lowest.base.default.background,
|
||||
|
||||
git_created: theme.lowest.positive.default.foreground,
|
||||
git_modified: theme.lowest.accent.default.foreground,
|
||||
git_deleted: theme.lowest.negative.default.foreground,
|
||||
git_conflict: theme.lowest.warning.default.foreground,
|
||||
git_ignored: theme.lowest.base.disabled.foreground,
|
||||
git_renamed: theme.lowest.warning.default.foreground,
|
||||
git_created: legacy_theme.lowest.positive.default.foreground,
|
||||
git_modified: legacy_theme.lowest.accent.default.foreground,
|
||||
git_deleted: legacy_theme.lowest.negative.default.foreground,
|
||||
git_conflict: legacy_theme.lowest.warning.default.foreground,
|
||||
git_ignored: legacy_theme.lowest.base.disabled.foreground,
|
||||
git_renamed: legacy_theme.lowest.warning.default.foreground,
|
||||
|
||||
players,
|
||||
};
|
||||
@@ -168,11 +169,22 @@ fn convert_theme(theme: LegacyTheme) -> Result<theme2::Theme> {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonTheme {
|
||||
pub editor: JsonEditorTheme,
|
||||
pub base_theme: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonEditorTheme {
|
||||
pub syntax: HashMap<String, JsonSyntaxStyle>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsonSyntaxStyle {
|
||||
pub color: Hsla,
|
||||
}
|
||||
|
||||
/// Loads the [`Theme`] with the given name.
|
||||
pub fn load_theme(name: String) -> Result<LegacyTheme> {
|
||||
fn load_theme(name: String) -> Result<(JsonTheme, LegacyTheme)> {
|
||||
let theme_contents = Assets::get(&format!("themes/{name}.json"))
|
||||
.with_context(|| format!("theme file not found: '{name}'"))?;
|
||||
|
||||
@@ -182,7 +194,7 @@ pub fn load_theme(name: String) -> Result<LegacyTheme> {
|
||||
let legacy_theme: LegacyTheme = serde_json::from_value(json_theme.base_theme.clone())
|
||||
.context("failed to parse `base_theme`")?;
|
||||
|
||||
Ok(legacy_theme)
|
||||
Ok((json_theme, legacy_theme))
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Default, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user