Remove old themes using UserTheme constructs (#6897)

This PR removes the themes defined using the `UserTheme` types, as we're
now loading the themes via JSON.

The `theme_importer` has also been reworked to read in a VS Code theme
and output a new JSON theme.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-01-27 16:55:37 -05:00 committed by GitHub
parent 5f1dcb76fe
commit 9b453d2cbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 142 additions and 23067 deletions

View File

@ -8,7 +8,6 @@ license = "GPL-3.0-or-later"
[features]
default = []
importing-themes = []
stories = ["dep:itertools", "dep:story"]
test-support = [
"gpui/test-support",

View File

@ -1249,6 +1249,12 @@ pub struct HighlightStyleContent {
pub font_weight: Option<FontWeightContent>,
}
impl HighlightStyleContent {
pub fn is_empty(&self) -> bool {
self.color.is_none() && self.font_style.is_none() && self.font_weight.is_none()
}
}
fn treat_error_as_none<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
where
T: Deserialize<'de>,

View File

@ -15,9 +15,6 @@ mod scale;
mod schema;
mod settings;
mod styles;
#[cfg(not(feature = "importing-themes"))]
mod themes;
mod user_theme;
use std::sync::Arc;
@ -29,9 +26,6 @@ pub use scale::*;
pub use schema::*;
pub use settings::*;
pub use styles::*;
#[cfg(not(feature = "importing-themes"))]
pub use themes::*;
pub use user_theme::*;
use gpui::{AppContext, AssetSource, Hsla, SharedString};
use serde::Deserialize;

View File

@ -1,473 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
pub fn andromeda() -> UserThemeFamily {
UserThemeFamily {
name: "Andromeda".into(),
author: "Zed Industries".into(),
themes: vec![UserTheme {
name: "Andromeda".into(),
appearance: Appearance::Dark,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x2b2f39ff).into()),
border_variant: Some(rgba(0x252931ff).into()),
border_focused: Some(rgba(0x183a34ff).into()),
border_selected: Some(rgba(0x183a34ff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0x292d37ff).into()),
elevated_surface_background: Some(rgba(0x21242bff).into()),
surface_background: Some(rgba(0x21242bff).into()),
background: Some(rgba(0x262a33ff).into()),
panel_background: Some(rgba(0x21242bff).into()),
element_background: Some(rgba(0x21242bff).into()),
element_hover: Some(rgba(0x252931ff).into()),
element_active: Some(rgba(0x2a2f39ff).into()),
element_selected: Some(rgba(0x2a2f39ff).into()),
element_disabled: Some(rgba(0x21242bff).into()),
drop_target_background: Some(rgba(0xaca8ae80).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0x252931ff).into()),
ghost_element_active: Some(rgba(0x2a2f39ff).into()),
ghost_element_selected: Some(rgba(0x2a2f39ff).into()),
ghost_element_disabled: Some(rgba(0x21242bff).into()),
text: Some(rgba(0xf7f7f8ff).into()),
text_muted: Some(rgba(0xaca8aeff).into()),
text_placeholder: Some(rgba(0x6b6b73ff).into()),
text_disabled: Some(rgba(0x6b6b73ff).into()),
text_accent: Some(rgba(0x11a793ff).into()),
icon: Some(rgba(0xf7f7f8ff).into()),
icon_muted: Some(rgba(0xaca8aeff).into()),
icon_disabled: Some(rgba(0x6b6b73ff).into()),
icon_placeholder: Some(rgba(0xaca8aeff).into()),
icon_accent: Some(rgba(0x11a793ff).into()),
status_bar_background: Some(rgba(0x262a33ff).into()),
title_bar_background: Some(rgba(0x262a33ff).into()),
toolbar_background: Some(rgba(0x1e2025ff).into()),
tab_bar_background: Some(rgba(0x21242bff).into()),
tab_inactive_background: Some(rgba(0x21242bff).into()),
tab_active_background: Some(rgba(0x1e2025ff).into()),
scrollbar_thumb_background: Some(rgba(0xf7f7f84c).into()),
scrollbar_thumb_hover_background: Some(rgba(0x252931ff).into()),
scrollbar_thumb_border: Some(rgba(0x252931ff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0x21232aff).into()),
editor_foreground: Some(rgba(0xf7f7f8ff).into()),
editor_background: Some(rgba(0x1e2025ff).into()),
editor_gutter_background: Some(rgba(0x1e2025ff).into()),
editor_subheader_background: Some(rgba(0x21242bff).into()),
editor_active_line_background: Some(rgba(0x21242bbf).into()),
editor_highlighted_line_background: Some(rgba(0x21242bff).into()),
editor_line_number: Some(rgba(0xf7f7f859).into()),
editor_active_line_number: Some(rgba(0xf7f7f8ff).into()),
editor_invisible: Some(rgba(0x64646dff).into()),
editor_wrap_guide: Some(rgba(0xf7f7f80d).into()),
editor_active_wrap_guide: Some(rgba(0xf7f7f81a).into()),
editor_document_highlight_read_background: Some(rgba(0x11a7931a).into()),
editor_document_highlight_write_background: Some(rgba(0x64646d66).into()),
terminal_background: Some(rgba(0x1e2025ff).into()),
terminal_foreground: Some(rgba(0xf7f7f8ff).into()),
terminal_bright_foreground: Some(rgba(0xf7f7f8ff).into()),
terminal_dim_foreground: Some(rgba(0x1e2025ff).into()),
terminal_ansi_black: Some(rgba(0x1e2025ff).into()),
terminal_ansi_bright_black: Some(rgba(0x40434cff).into()),
terminal_ansi_dim_black: Some(rgba(0xf7f7f8ff).into()),
terminal_ansi_red: Some(rgba(0xf82872ff).into()),
terminal_ansi_bright_red: Some(rgba(0x8e103aff).into()),
terminal_ansi_dim_red: Some(rgba(0xffa3b6ff).into()),
terminal_ansi_green: Some(rgba(0x96df72ff).into()),
terminal_ansi_bright_green: Some(rgba(0x457c38ff).into()),
terminal_ansi_dim_green: Some(rgba(0xcef0b9ff).into()),
terminal_ansi_yellow: Some(rgba(0xfee56dff).into()),
terminal_ansi_bright_yellow: Some(rgba(0x958435ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0xfff2b8ff).into()),
terminal_ansi_blue: Some(rgba(0x11a793ff).into()),
terminal_ansi_bright_blue: Some(rgba(0x1b5148ff).into()),
terminal_ansi_dim_blue: Some(rgba(0x9cd4c8ff).into()),
terminal_ansi_magenta: Some(rgba(0xc74decff).into()),
terminal_ansi_bright_magenta: Some(rgba(0x682781ff).into()),
terminal_ansi_dim_magenta: Some(rgba(0xe8abf7ff).into()),
terminal_ansi_cyan: Some(rgba(0x09e7c6ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x018169ff).into()),
terminal_ansi_dim_cyan: Some(rgba(0xaaf5e2ff).into()),
terminal_ansi_white: Some(rgba(0xf7f7f8ff).into()),
terminal_ansi_bright_white: Some(rgba(0xf7f7f8ff).into()),
terminal_ansi_dim_white: Some(rgba(0x88868dff).into()),
link_text_hover: Some(rgba(0x11a793ff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xfee56dff).into()),
conflict_background: Some(rgba(0x5c5015ff).into()),
conflict_border: Some(rgba(0x796b26ff).into()),
created: Some(rgba(0x96df72ff).into()),
created_background: Some(rgba(0x194618ff).into()),
created_border: Some(rgba(0x306129ff).into()),
deleted: Some(rgba(0xf82872ff).into()),
deleted_background: Some(rgba(0x55051bff).into()),
deleted_border: Some(rgba(0x720a2bff).into()),
error: Some(rgba(0xf82872ff).into()),
error_background: Some(rgba(0x55051bff).into()),
error_border: Some(rgba(0x720a2bff).into()),
hidden: Some(rgba(0x6b6b73ff).into()),
hidden_background: Some(rgba(0x262a33ff).into()),
hidden_border: Some(rgba(0x292d37ff).into()),
hint: Some(rgba(0x618399ff).into()),
hint_background: Some(rgba(0x122420ff).into()),
hint_border: Some(rgba(0x183a34ff).into()),
ignored: Some(rgba(0xaca8aeff).into()),
ignored_background: Some(rgba(0x262a33ff).into()),
ignored_border: Some(rgba(0x2b2f39ff).into()),
info: Some(rgba(0x11a793ff).into()),
info_background: Some(rgba(0x122420ff).into()),
info_border: Some(rgba(0x183a34ff).into()),
modified: Some(rgba(0xfee56dff).into()),
modified_background: Some(rgba(0x5c5015ff).into()),
modified_border: Some(rgba(0x796b26ff).into()),
predictive: Some(rgba(0x315f70ff).into()),
predictive_background: Some(rgba(0x194618ff).into()),
predictive_border: Some(rgba(0x306129ff).into()),
renamed: Some(rgba(0x11a793ff).into()),
renamed_background: Some(rgba(0x122420ff).into()),
renamed_border: Some(rgba(0x183a34ff).into()),
success: Some(rgba(0x96df72ff).into()),
success_background: Some(rgba(0x194618ff).into()),
success_border: Some(rgba(0x306129ff).into()),
unreachable: Some(rgba(0xaca8aeff).into()),
unreachable_background: Some(rgba(0x262a33ff).into()),
unreachable_border: Some(rgba(0x2b2f39ff).into()),
warning: Some(rgba(0xfee56dff).into()),
warning_background: Some(rgba(0x5c5015ff).into()),
warning_border: Some(rgba(0x796b26ff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x11a793ff).into(),
background: rgba(0x11a793ff).into(),
selection: rgba(0x11a7933d).into(),
},
PlayerColor {
cursor: rgba(0xc74decff).into(),
background: rgba(0xc74decff).into(),
selection: rgba(0xc74dec3d).into(),
},
PlayerColor {
cursor: rgba(0xf29c14ff).into(),
background: rgba(0xf29c14ff).into(),
selection: rgba(0xf29c143d).into(),
},
PlayerColor {
cursor: rgba(0x8a3fa6ff).into(),
background: rgba(0x8a3fa6ff).into(),
selection: rgba(0x8a3fa63d).into(),
},
PlayerColor {
cursor: rgba(0x09e7c6ff).into(),
background: rgba(0x09e7c6ff).into(),
selection: rgba(0x09e7c63d).into(),
},
PlayerColor {
cursor: rgba(0xf82872ff).into(),
background: rgba(0xf82872ff).into(),
selection: rgba(0xf828723d).into(),
},
PlayerColor {
cursor: rgba(0xfee56dff).into(),
background: rgba(0xfee56dff).into(),
selection: rgba(0xfee56d3d).into(),
},
PlayerColor {
cursor: rgba(0x96df72ff).into(),
background: rgba(0x96df72ff).into(),
selection: rgba(0x96df723d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x96df72ff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0xafabb1ff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0xafabb1ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x96df72ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0xf7f7f8ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0xfee56dff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x618399ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x96df72ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0x96df72ff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x315f70ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0xf7f7f8ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0xf7f7f8ff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xd8d5dbff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0xd8d5dbff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0xd8d5dbff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xd8d5dbff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xd8d5dbff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0xafabb1ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xf29c14ff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xf7f7f8ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x09e7c6ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xf7f7f8ff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x11a793ff).into()),
..Default::default()
},
),
],
}),
},
}],
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
mod andromeda;
mod atelier;
mod ayu;
mod gruvbox;
mod one;
mod rose_pine;
mod sandcastle;
mod solarized;
mod summercamp;
pub use andromeda::*;
pub use atelier::*;
pub use ayu::*;
pub use gruvbox::*;
pub use one::*;
pub use rose_pine::*;
pub use sandcastle::*;
pub use solarized::*;
pub use summercamp::*;
use crate::UserThemeFamily;
pub fn all_user_themes() -> Vec<UserThemeFamily> {
vec![
andromeda(),
atelier(),
ayu(),
gruvbox(),
one(),
rose_pine(),
sandcastle(),
solarized(),
summercamp(),
]
}

View File

@ -1,944 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
pub fn one() -> UserThemeFamily {
UserThemeFamily {
name: "One".into(),
author: "Zed Industries".into(),
themes: vec![
UserTheme {
name: "One Dark".into(),
appearance: Appearance::Dark,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x464b57ff).into()),
border_variant: Some(rgba(0x363c46ff).into()),
border_focused: Some(rgba(0x293c5bff).into()),
border_selected: Some(rgba(0x293c5bff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0x414754ff).into()),
elevated_surface_background: Some(rgba(0x2f343eff).into()),
surface_background: Some(rgba(0x2f343eff).into()),
background: Some(rgba(0x3b414dff).into()),
panel_background: Some(rgba(0x2f343eff).into()),
element_background: Some(rgba(0x2f343eff).into()),
element_hover: Some(rgba(0x363c46ff).into()),
element_active: Some(rgba(0x454a56ff).into()),
element_selected: Some(rgba(0x454a56ff).into()),
element_disabled: Some(rgba(0x2f343eff).into()),
drop_target_background: Some(rgba(0x83899480).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0x363c46ff).into()),
ghost_element_active: Some(rgba(0x454a56ff).into()),
ghost_element_selected: Some(rgba(0x454a56ff).into()),
ghost_element_disabled: Some(rgba(0x2f343eff).into()),
text: Some(rgba(0xc8ccd4ff).into()),
text_muted: Some(rgba(0x838994ff).into()),
text_placeholder: Some(rgba(0x555a63ff).into()),
text_disabled: Some(rgba(0x555a63ff).into()),
text_accent: Some(rgba(0x74ade8ff).into()),
icon: Some(rgba(0xc8ccd4ff).into()),
icon_muted: Some(rgba(0x838994ff).into()),
icon_disabled: Some(rgba(0x555a63ff).into()),
icon_placeholder: Some(rgba(0x838994ff).into()),
icon_accent: Some(rgba(0x74ade8ff).into()),
status_bar_background: Some(rgba(0x3b414dff).into()),
title_bar_background: Some(rgba(0x3b414dff).into()),
toolbar_background: Some(rgba(0x282c34ff).into()),
tab_bar_background: Some(rgba(0x2f343eff).into()),
tab_inactive_background: Some(rgba(0x2f343eff).into()),
tab_active_background: Some(rgba(0x282c34ff).into()),
scrollbar_thumb_background: Some(rgba(0xc8ccd44c).into()),
scrollbar_thumb_hover_background: Some(rgba(0x363c46ff).into()),
scrollbar_thumb_border: Some(rgba(0x363c46ff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0x2e333cff).into()),
editor_foreground: Some(rgba(0xacb2beff).into()),
editor_background: Some(rgba(0x282c34ff).into()),
editor_gutter_background: Some(rgba(0x282c34ff).into()),
editor_subheader_background: Some(rgba(0x2f343eff).into()),
editor_active_line_background: Some(rgba(0x2f343ebf).into()),
editor_highlighted_line_background: Some(rgba(0x2f343eff).into()),
editor_line_number: Some(rgba(0xc8ccd459).into()),
editor_active_line_number: Some(rgba(0xc8ccd4ff).into()),
editor_invisible: Some(rgba(0x555a63ff).into()),
editor_wrap_guide: Some(rgba(0xc8ccd40d).into()),
editor_active_wrap_guide: Some(rgba(0xc8ccd41a).into()),
editor_document_highlight_read_background: Some(rgba(0x74ade81a).into()),
editor_document_highlight_write_background: Some(rgba(0x555a6366).into()),
terminal_background: Some(rgba(0x282c34ff).into()),
terminal_foreground: Some(rgba(0xc8ccd4ff).into()),
terminal_bright_foreground: Some(rgba(0xc8ccd4ff).into()),
terminal_dim_foreground: Some(rgba(0x282c34ff).into()),
terminal_ansi_black: Some(rgba(0x282c34ff).into()),
terminal_ansi_bright_black: Some(rgba(0x525661ff).into()),
terminal_ansi_dim_black: Some(rgba(0xc8ccd4ff).into()),
terminal_ansi_red: Some(rgba(0xd07277ff).into()),
terminal_ansi_bright_red: Some(rgba(0x673a3cff).into()),
terminal_ansi_dim_red: Some(rgba(0xebb8b9ff).into()),
terminal_ansi_green: Some(rgba(0xa1c181ff).into()),
terminal_ansi_bright_green: Some(rgba(0x4d6140ff).into()),
terminal_ansi_dim_green: Some(rgba(0xd1e0bfff).into()),
terminal_ansi_yellow: Some(rgba(0xdec184ff).into()),
terminal_ansi_bright_yellow: Some(rgba(0x786441ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0xf1dfc1ff).into()),
terminal_ansi_blue: Some(rgba(0x74ade8ff).into()),
terminal_ansi_bright_blue: Some(rgba(0x385378ff).into()),
terminal_ansi_dim_blue: Some(rgba(0xbed5f4ff).into()),
terminal_ansi_magenta: Some(rgba(0xbe5046ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0x5e2b26ff).into()),
terminal_ansi_dim_magenta: Some(rgba(0xe6a79eff).into()),
terminal_ansi_cyan: Some(rgba(0x6fb4c0ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x3a565bff).into()),
terminal_ansi_dim_cyan: Some(rgba(0xb9d9dfff).into()),
terminal_ansi_white: Some(rgba(0xc8ccd4ff).into()),
terminal_ansi_bright_white: Some(rgba(0xc8ccd4ff).into()),
terminal_ansi_dim_white: Some(rgba(0x575d65ff).into()),
link_text_hover: Some(rgba(0x74ade8ff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xdec184ff).into()),
conflict_background: Some(rgba(0x41331dff).into()),
conflict_border: Some(rgba(0x5d4c2fff).into()),
created: Some(rgba(0xa1c181ff).into()),
created_background: Some(rgba(0x222e1dff).into()),
created_border: Some(rgba(0x38482fff).into()),
deleted: Some(rgba(0xd07277ff).into()),
deleted_background: Some(rgba(0x301b1cff).into()),
deleted_border: Some(rgba(0x4c2b2cff).into()),
error: Some(rgba(0xd07277ff).into()),
error_background: Some(rgba(0x301b1cff).into()),
error_border: Some(rgba(0x4c2b2cff).into()),
hidden: Some(rgba(0x555a63ff).into()),
hidden_background: Some(rgba(0x3b414dff).into()),
hidden_border: Some(rgba(0x414754ff).into()),
hint: Some(rgba(0x5b708aff).into()),
hint_background: Some(rgba(0x18243dff).into()),
hint_border: Some(rgba(0x293c5bff).into()),
ignored: Some(rgba(0x838994ff).into()),
ignored_background: Some(rgba(0x3b414dff).into()),
ignored_border: Some(rgba(0x464b57ff).into()),
info: Some(rgba(0x74ade8ff).into()),
info_background: Some(rgba(0x18243dff).into()),
info_border: Some(rgba(0x293c5bff).into()),
modified: Some(rgba(0xdec184ff).into()),
modified_background: Some(rgba(0x41331dff).into()),
modified_border: Some(rgba(0x5d4c2fff).into()),
predictive: Some(rgba(0x5b6b88ff).into()),
predictive_background: Some(rgba(0x222e1dff).into()),
predictive_border: Some(rgba(0x38482fff).into()),
renamed: Some(rgba(0x74ade8ff).into()),
renamed_background: Some(rgba(0x18243dff).into()),
renamed_border: Some(rgba(0x293c5bff).into()),
success: Some(rgba(0xa1c181ff).into()),
success_background: Some(rgba(0x222e1dff).into()),
success_border: Some(rgba(0x38482fff).into()),
unreachable: Some(rgba(0x838994ff).into()),
unreachable_background: Some(rgba(0x3b414dff).into()),
unreachable_border: Some(rgba(0x464b57ff).into()),
warning: Some(rgba(0xdec184ff).into()),
warning_background: Some(rgba(0x41331dff).into()),
warning_border: Some(rgba(0x5d4c2fff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x74ade8ff).into(),
background: rgba(0x74ade8ff).into(),
selection: rgba(0x74ade83d).into(),
},
PlayerColor {
cursor: rgba(0xbe5046ff).into(),
background: rgba(0xbe5046ff).into(),
selection: rgba(0xbe50463d).into(),
},
PlayerColor {
cursor: rgba(0xc0966bff).into(),
background: rgba(0xc0966bff).into(),
selection: rgba(0xc0966b3d).into(),
},
PlayerColor {
cursor: rgba(0xb478cfff).into(),
background: rgba(0xb478cfff).into(),
selection: rgba(0xb478cf3d).into(),
},
PlayerColor {
cursor: rgba(0x6fb4c0ff).into(),
background: rgba(0x6fb4c0ff).into(),
selection: rgba(0x6fb4c03d).into(),
},
PlayerColor {
cursor: rgba(0xd07277ff).into(),
background: rgba(0xd07277ff).into(),
selection: rgba(0xd072773d).into(),
},
PlayerColor {
cursor: rgba(0xdec184ff).into(),
background: rgba(0xdec184ff).into(),
selection: rgba(0xdec1843d).into(),
},
PlayerColor {
cursor: rgba(0xa1c181ff).into(),
background: rgba(0xa1c181ff).into(),
selection: rgba(0xa1c1813d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade8ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0x5d636fff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0x878e98ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0xdfc184ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade9ff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0xc8ccd4ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade8ff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xd07277ff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade9ff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x5b708aff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0xb478cfff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade8ff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade9ff).into()),
font_style: Some(UserFontStyle::Normal),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x6fb4c0ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0x6fb4c0ff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x5b6b88ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0xc8ccd4ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0xacb2beff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0xd07277ff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xacb2beff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0xb2b9c6ff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0xb2b9c6ff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xd07277ff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xb1574bff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xa1c181ff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0x878e98ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade8ff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xa1c181ff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xd07277ff).into()),
font_weight: Some(UserFontWeight(400.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x6fb4c0ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xc8ccd4ff).into()),
..Default::default()
},
),
(
"variable.special".into(),
UserHighlightStyle {
color: Some(rgba(0xc0966bff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x74ade9ff).into()),
..Default::default()
},
),
],
}),
},
},
UserTheme {
name: "One Light".into(),
appearance: Appearance::Light,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0xc9c9caff).into()),
border_variant: Some(rgba(0xdfdfe0ff).into()),
border_focused: Some(rgba(0xcbcdf6ff).into()),
border_selected: Some(rgba(0xcbcdf6ff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0xd3d3d4ff).into()),
elevated_surface_background: Some(rgba(0xebebecff).into()),
surface_background: Some(rgba(0xebebecff).into()),
background: Some(rgba(0xdcdcddff).into()),
panel_background: Some(rgba(0xebebecff).into()),
element_background: Some(rgba(0xebebecff).into()),
element_hover: Some(rgba(0xdfdfe0ff).into()),
element_active: Some(rgba(0xcacacaff).into()),
element_selected: Some(rgba(0xcacacaff).into()),
element_disabled: Some(rgba(0xebebecff).into()),
drop_target_background: Some(rgba(0x7f818880).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0xdfdfe0ff).into()),
ghost_element_active: Some(rgba(0xcacacaff).into()),
ghost_element_selected: Some(rgba(0xcacacaff).into()),
ghost_element_disabled: Some(rgba(0xebebecff).into()),
text: Some(rgba(0x383a41ff).into()),
text_muted: Some(rgba(0x7f8188ff).into()),
text_placeholder: Some(rgba(0xa1a1a3ff).into()),
text_disabled: Some(rgba(0xa1a1a3ff).into()),
text_accent: Some(rgba(0x5c79e2ff).into()),
icon: Some(rgba(0x383a41ff).into()),
icon_muted: Some(rgba(0x7f8188ff).into()),
icon_disabled: Some(rgba(0xa1a1a3ff).into()),
icon_placeholder: Some(rgba(0x7f8188ff).into()),
icon_accent: Some(rgba(0x5c79e2ff).into()),
status_bar_background: Some(rgba(0xdcdcddff).into()),
title_bar_background: Some(rgba(0xdcdcddff).into()),
toolbar_background: Some(rgba(0xfafafaff).into()),
tab_bar_background: Some(rgba(0xebebecff).into()),
tab_inactive_background: Some(rgba(0xebebecff).into()),
tab_active_background: Some(rgba(0xfafafaff).into()),
scrollbar_thumb_background: Some(rgba(0x383a414c).into()),
scrollbar_thumb_hover_background: Some(rgba(0xdfdfe0ff).into()),
scrollbar_thumb_border: Some(rgba(0xdfdfe0ff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0xeeeeeeff).into()),
editor_foreground: Some(rgba(0x383a41ff).into()),
editor_background: Some(rgba(0xfafafaff).into()),
editor_gutter_background: Some(rgba(0xfafafaff).into()),
editor_subheader_background: Some(rgba(0xebebecff).into()),
editor_active_line_background: Some(rgba(0xebebecbf).into()),
editor_highlighted_line_background: Some(rgba(0xebebecff).into()),
editor_line_number: Some(rgba(0x383a4159).into()),
editor_active_line_number: Some(rgba(0x383a41ff).into()),
editor_invisible: Some(rgba(0xa3a3a4ff).into()),
editor_wrap_guide: Some(rgba(0x383a410d).into()),
editor_active_wrap_guide: Some(rgba(0x383a411a).into()),
editor_document_highlight_read_background: Some(rgba(0x5c79e21a).into()),
editor_document_highlight_write_background: Some(rgba(0xa3a3a466).into()),
terminal_background: Some(rgba(0xfafafaff).into()),
terminal_foreground: Some(rgba(0x383a41ff).into()),
terminal_bright_foreground: Some(rgba(0x383a41ff).into()),
terminal_dim_foreground: Some(rgba(0xfafafaff).into()),
terminal_ansi_black: Some(rgba(0xfafafaff).into()),
terminal_ansi_bright_black: Some(rgba(0xaaaaaaff).into()),
terminal_ansi_dim_black: Some(rgba(0x383a41ff).into()),
terminal_ansi_red: Some(rgba(0xd36151ff).into()),
terminal_ansi_bright_red: Some(rgba(0xf0b0a4ff).into()),
terminal_ansi_dim_red: Some(rgba(0x6f312aff).into()),
terminal_ansi_green: Some(rgba(0x669f59ff).into()),
terminal_ansi_bright_green: Some(rgba(0xb2cfa9ff).into()),
terminal_ansi_dim_green: Some(rgba(0x354d2eff).into()),
terminal_ansi_yellow: Some(rgba(0xdec184ff).into()),
terminal_ansi_bright_yellow: Some(rgba(0xf1dfc1ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0x786441ff).into()),
terminal_ansi_blue: Some(rgba(0x5c79e2ff).into()),
terminal_ansi_bright_blue: Some(rgba(0xb5baf2ff).into()),
terminal_ansi_dim_blue: Some(rgba(0x2d3d75ff).into()),
terminal_ansi_magenta: Some(rgba(0x994fa6ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0xcea6d3ff).into()),
terminal_ansi_dim_magenta: Some(rgba(0x4b2a50ff).into()),
terminal_ansi_cyan: Some(rgba(0x3b82b7ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0xa4bfdbff).into()),
terminal_ansi_dim_cyan: Some(rgba(0x254058ff).into()),
terminal_ansi_white: Some(rgba(0x383a41ff).into()),
terminal_ansi_bright_white: Some(rgba(0x383a41ff).into()),
terminal_ansi_dim_white: Some(rgba(0x98989bff).into()),
link_text_hover: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xdec184ff).into()),
conflict_background: Some(rgba(0xfaf2e6ff).into()),
conflict_border: Some(rgba(0xf5e8d2ff).into()),
created: Some(rgba(0x669f59ff).into()),
created_background: Some(rgba(0xe0ebdcff).into()),
created_border: Some(rgba(0xc8dcc1ff).into()),
deleted: Some(rgba(0xd36151ff).into()),
deleted_background: Some(rgba(0xfbdfd9ff).into()),
deleted_border: Some(rgba(0xf6c6bdff).into()),
error: Some(rgba(0xd36151ff).into()),
error_background: Some(rgba(0xfbdfd9ff).into()),
error_border: Some(rgba(0xf6c6bdff).into()),
hidden: Some(rgba(0xa1a1a3ff).into()),
hidden_background: Some(rgba(0xdcdcddff).into()),
hidden_border: Some(rgba(0xd3d3d4ff).into()),
hint: Some(rgba(0x9295beff).into()),
hint_background: Some(rgba(0xe2e2faff).into()),
hint_border: Some(rgba(0xcbcdf6ff).into()),
ignored: Some(rgba(0x7f8188ff).into()),
ignored_background: Some(rgba(0xdcdcddff).into()),
ignored_border: Some(rgba(0xc9c9caff).into()),
info: Some(rgba(0x5c79e2ff).into()),
info_background: Some(rgba(0xe2e2faff).into()),
info_border: Some(rgba(0xcbcdf6ff).into()),
modified: Some(rgba(0xdec184ff).into()),
modified_background: Some(rgba(0xfaf2e6ff).into()),
modified_border: Some(rgba(0xf5e8d2ff).into()),
predictive: Some(rgba(0x9c9fc7ff).into()),
predictive_background: Some(rgba(0xe0ebdcff).into()),
predictive_border: Some(rgba(0xc8dcc1ff).into()),
renamed: Some(rgba(0x5c79e2ff).into()),
renamed_background: Some(rgba(0xe2e2faff).into()),
renamed_border: Some(rgba(0xcbcdf6ff).into()),
success: Some(rgba(0x669f59ff).into()),
success_background: Some(rgba(0xe0ebdcff).into()),
success_border: Some(rgba(0xc8dcc1ff).into()),
unreachable: Some(rgba(0x7f8188ff).into()),
unreachable_background: Some(rgba(0xdcdcddff).into()),
unreachable_border: Some(rgba(0xc9c9caff).into()),
warning: Some(rgba(0xdec184ff).into()),
warning_background: Some(rgba(0xfaf2e6ff).into()),
warning_border: Some(rgba(0xf5e8d2ff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x5c79e2ff).into(),
background: rgba(0x5c79e2ff).into(),
selection: rgba(0x5c79e23d).into(),
},
PlayerColor {
cursor: rgba(0x994fa6ff).into(),
background: rgba(0x994fa6ff).into(),
selection: rgba(0x994fa63d).into(),
},
PlayerColor {
cursor: rgba(0xad6f27ff).into(),
background: rgba(0xad6f27ff).into(),
selection: rgba(0xad6f273d).into(),
},
PlayerColor {
cursor: rgba(0xa44aabff).into(),
background: rgba(0xa44aabff).into(),
selection: rgba(0xa44aab3d).into(),
},
PlayerColor {
cursor: rgba(0x3b82b7ff).into(),
background: rgba(0x3b82b7ff).into(),
selection: rgba(0x3b82b73d).into(),
},
PlayerColor {
cursor: rgba(0xd36151ff).into(),
background: rgba(0xd36151ff).into(),
selection: rgba(0xd361513d).into(),
},
PlayerColor {
cursor: rgba(0xdec184ff).into(),
background: rgba(0xdec184ff).into(),
selection: rgba(0xdec1843d).into(),
},
PlayerColor {
cursor: rgba(0x669f59ff).into(),
background: rgba(0x669f59ff).into(),
selection: rgba(0x669f593d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f26ff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0xa2a3a7ff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0x7c7e86ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x669f59ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0x383a41ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f26ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xd36050ff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0x5b79e3ff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x9295beff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0xa449abff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0x5b79e3ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x3982b7ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f26ff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0x3982b7ff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x9c9fc7ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0x383a41ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0x383a41ff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0xd36050ff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0x383a41ff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0x4d4f52ff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0x4d4f52ff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xd36050ff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xb92c46ff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0x659f58ff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0x7c7e86ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f27ff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f27ff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f27ff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x5c79e2ff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0x659f58ff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xd36050ff).into()),
font_weight: Some(UserFontWeight(400.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x3982b7ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0x383a41ff).into()),
..Default::default()
},
),
(
"variable.special".into(),
UserHighlightStyle {
color: Some(rgba(0xad6f26ff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x5b79e3ff).into()),
..Default::default()
},
),
],
}),
},
},
],
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,473 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
pub fn sandcastle() -> UserThemeFamily {
UserThemeFamily {
name: "Sandcastle".into(),
author: "Zed Industries".into(),
themes: vec![UserTheme {
name: "Sandcastle".into(),
appearance: Appearance::Dark,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x3d4350ff).into()),
border_variant: Some(rgba(0x313741ff).into()),
border_focused: Some(rgba(0x223232ff).into()),
border_selected: Some(rgba(0x223232ff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0x393f4aff).into()),
elevated_surface_background: Some(rgba(0x2b3039ff).into()),
surface_background: Some(rgba(0x2b3039ff).into()),
background: Some(rgba(0x333944ff).into()),
panel_background: Some(rgba(0x2b3039ff).into()),
element_background: Some(rgba(0x2b3039ff).into()),
element_hover: Some(rgba(0x313741ff).into()),
element_active: Some(rgba(0x3d4350ff).into()),
element_selected: Some(rgba(0x3d4350ff).into()),
element_disabled: Some(rgba(0x2b3039ff).into()),
drop_target_background: Some(rgba(0xa6978280).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0x313741ff).into()),
ghost_element_active: Some(rgba(0x3d4350ff).into()),
ghost_element_selected: Some(rgba(0x3d4350ff).into()),
ghost_element_disabled: Some(rgba(0x2b3039ff).into()),
text: Some(rgba(0xfdf4c1ff).into()),
text_muted: Some(rgba(0xa69782ff).into()),
text_placeholder: Some(rgba(0x827568ff).into()),
text_disabled: Some(rgba(0x827568ff).into()),
text_accent: Some(rgba(0x528b8bff).into()),
icon: Some(rgba(0xfdf4c1ff).into()),
icon_muted: Some(rgba(0xa69782ff).into()),
icon_disabled: Some(rgba(0x827568ff).into()),
icon_placeholder: Some(rgba(0xa69782ff).into()),
icon_accent: Some(rgba(0x528b8bff).into()),
status_bar_background: Some(rgba(0x333944ff).into()),
title_bar_background: Some(rgba(0x333944ff).into()),
toolbar_background: Some(rgba(0x282c34ff).into()),
tab_bar_background: Some(rgba(0x2b3039ff).into()),
tab_inactive_background: Some(rgba(0x2b3039ff).into()),
tab_active_background: Some(rgba(0x282c34ff).into()),
scrollbar_thumb_background: Some(rgba(0xfdf4c14c).into()),
scrollbar_thumb_hover_background: Some(rgba(0x313741ff).into()),
scrollbar_thumb_border: Some(rgba(0x313741ff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0x2a2f38ff).into()),
editor_foreground: Some(rgba(0xfdf4c1ff).into()),
editor_background: Some(rgba(0x282c34ff).into()),
editor_gutter_background: Some(rgba(0x282c34ff).into()),
editor_subheader_background: Some(rgba(0x2b3039ff).into()),
editor_active_line_background: Some(rgba(0x2b3039bf).into()),
editor_highlighted_line_background: Some(rgba(0x2b3039ff).into()),
editor_line_number: Some(rgba(0xfdf4c159).into()),
editor_active_line_number: Some(rgba(0xfdf4c1ff).into()),
editor_invisible: Some(rgba(0x7c6f64ff).into()),
editor_wrap_guide: Some(rgba(0xfdf4c10d).into()),
editor_active_wrap_guide: Some(rgba(0xfdf4c11a).into()),
editor_document_highlight_read_background: Some(rgba(0x528b8b1a).into()),
editor_document_highlight_write_background: Some(rgba(0x7c6f6466).into()),
terminal_background: Some(rgba(0x282c34ff).into()),
terminal_foreground: Some(rgba(0xfdf4c1ff).into()),
terminal_bright_foreground: Some(rgba(0xfdf4c1ff).into()),
terminal_dim_foreground: Some(rgba(0x282c34ff).into()),
terminal_ansi_black: Some(rgba(0x282c34ff).into()),
terminal_ansi_bright_black: Some(rgba(0x5e5753ff).into()),
terminal_ansi_dim_black: Some(rgba(0xfdf4c1ff).into()),
terminal_ansi_red: Some(rgba(0xb4637aff).into()),
terminal_ansi_bright_red: Some(rgba(0x57333dff).into()),
terminal_ansi_dim_red: Some(rgba(0xdcb0bbff).into()),
terminal_ansi_green: Some(rgba(0x83a598ff).into()),
terminal_ansi_bright_green: Some(rgba(0x414f4aff).into()),
terminal_ansi_dim_green: Some(rgba(0xc0d2cbff).into()),
terminal_ansi_yellow: Some(rgba(0xa07e3bff).into()),
terminal_ansi_bright_yellow: Some(rgba(0x4e3f22ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0xd3bd9aff).into()),
terminal_ansi_blue: Some(rgba(0x528b8bff).into()),
terminal_ansi_bright_blue: Some(rgba(0x2c4444ff).into()),
terminal_ansi_dim_blue: Some(rgba(0xa8c4c4ff).into()),
terminal_ansi_magenta: Some(rgba(0xa87323ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0x523a18ff).into()),
terminal_ansi_dim_magenta: Some(rgba(0xdab78eff).into()),
terminal_ansi_cyan: Some(rgba(0x83a598ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x414f4aff).into()),
terminal_ansi_dim_cyan: Some(rgba(0xc0d2cbff).into()),
terminal_ansi_white: Some(rgba(0xfdf4c1ff).into()),
terminal_ansi_bright_white: Some(rgba(0xfdf4c1ff).into()),
terminal_ansi_dim_white: Some(rgba(0x968777ff).into()),
link_text_hover: Some(rgba(0x528b8bff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xa07e3bff).into()),
conflict_background: Some(rgba(0x231d12ff).into()),
conflict_border: Some(rgba(0x392e1aff).into()),
created: Some(rgba(0x83a598ff).into()),
created_background: Some(rgba(0x1e2321ff).into()),
created_border: Some(rgba(0x303a36ff).into()),
deleted: Some(rgba(0xb4637aff).into()),
deleted_background: Some(rgba(0x26191cff).into()),
deleted_border: Some(rgba(0x3f272dff).into()),
error: Some(rgba(0xb4637aff).into()),
error_background: Some(rgba(0x26191cff).into()),
error_border: Some(rgba(0x3f272dff).into()),
hidden: Some(rgba(0x827568ff).into()),
hidden_background: Some(rgba(0x333944ff).into()),
hidden_border: Some(rgba(0x393f4aff).into()),
hint: Some(rgba(0x727d68ff).into()),
hint_background: Some(rgba(0x171f1fff).into()),
hint_border: Some(rgba(0x223232ff).into()),
ignored: Some(rgba(0xa69782ff).into()),
ignored_background: Some(rgba(0x333944ff).into()),
ignored_border: Some(rgba(0x3d4350ff).into()),
info: Some(rgba(0x528b8bff).into()),
info_background: Some(rgba(0x171f1fff).into()),
info_border: Some(rgba(0x223232ff).into()),
modified: Some(rgba(0xa07e3bff).into()),
modified_background: Some(rgba(0x231d12ff).into()),
modified_border: Some(rgba(0x392e1aff).into()),
predictive: Some(rgba(0x5c6152ff).into()),
predictive_background: Some(rgba(0x1e2321ff).into()),
predictive_border: Some(rgba(0x303a36ff).into()),
renamed: Some(rgba(0x528b8bff).into()),
renamed_background: Some(rgba(0x171f1fff).into()),
renamed_border: Some(rgba(0x223232ff).into()),
success: Some(rgba(0x83a598ff).into()),
success_background: Some(rgba(0x1e2321ff).into()),
success_border: Some(rgba(0x303a36ff).into()),
unreachable: Some(rgba(0xa69782ff).into()),
unreachable_background: Some(rgba(0x333944ff).into()),
unreachable_border: Some(rgba(0x3d4350ff).into()),
warning: Some(rgba(0xa07e3bff).into()),
warning_background: Some(rgba(0x231d12ff).into()),
warning_border: Some(rgba(0x392e1aff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x528b8bff).into(),
background: rgba(0x528b8bff).into(),
selection: rgba(0x528b8b3d).into(),
},
PlayerColor {
cursor: rgba(0xa87323ff).into(),
background: rgba(0xa87323ff).into(),
selection: rgba(0xa873233d).into(),
},
PlayerColor {
cursor: rgba(0xa07e3bff).into(),
background: rgba(0xa07e3bff).into(),
selection: rgba(0xa07e3b3d).into(),
},
PlayerColor {
cursor: rgba(0xd75f5fff).into(),
background: rgba(0xd75f5fff).into(),
selection: rgba(0xd75f5f3d).into(),
},
PlayerColor {
cursor: rgba(0x83a598ff).into(),
background: rgba(0x83a598ff).into(),
selection: rgba(0x83a5983d).into(),
},
PlayerColor {
cursor: rgba(0xb4637aff).into(),
background: rgba(0xb4637aff).into(),
selection: rgba(0xb4637a3d).into(),
},
PlayerColor {
cursor: rgba(0xa07e3bff).into(),
background: rgba(0xa07e3bff).into(),
selection: rgba(0xa07e3b3d).into(),
},
PlayerColor {
cursor: rgba(0x83a598ff).into(),
background: rgba(0x83a598ff).into(),
selection: rgba(0x83a5983d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x83a598ff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0xa89984ff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0xa89984ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x83a598ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf4c1ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x727d68ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x83a598ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0x83a598ff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x5c6152ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf4c1ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf4c1ff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xd5c5a1ff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0xd5c5a1ff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0xd5c5a1ff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xd5c5a1ff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xd5c5a1ff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0xa89984ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xa07e3bff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf4c1ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x83a598ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf4c1ff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x528b8bff).into()),
..Default::default()
},
),
],
}),
},
}],
}
}

View File

@ -1,930 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
pub fn solarized() -> UserThemeFamily {
UserThemeFamily {
name: "Solarized".into(),
author: "Zed Industries".into(),
themes: vec![
UserTheme {
name: "Solarized Dark".into(),
appearance: Appearance::Dark,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x2b4f58ff).into()),
border_variant: Some(rgba(0x063541ff).into()),
border_focused: Some(rgba(0x1c3249ff).into()),
border_selected: Some(rgba(0x1c3249ff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0x19424dff).into()),
elevated_surface_background: Some(rgba(0x04313cff).into()),
surface_background: Some(rgba(0x04313cff).into()),
background: Some(rgba(0x083743ff).into()),
panel_background: Some(rgba(0x04313cff).into()),
element_background: Some(rgba(0x04313cff).into()),
element_hover: Some(rgba(0x063541ff).into()),
element_active: Some(rgba(0x294e58ff).into()),
element_selected: Some(rgba(0x294e58ff).into()),
element_disabled: Some(rgba(0x04313cff).into()),
drop_target_background: Some(rgba(0x93a1a180).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0x063541ff).into()),
ghost_element_active: Some(rgba(0x294e58ff).into()),
ghost_element_selected: Some(rgba(0x294e58ff).into()),
ghost_element_disabled: Some(rgba(0x04313cff).into()),
text: Some(rgba(0xfdf6e3ff).into()),
text_muted: Some(rgba(0x93a1a1ff).into()),
text_placeholder: Some(rgba(0x6f8389ff).into()),
text_disabled: Some(rgba(0x6f8389ff).into()),
text_accent: Some(rgba(0x288bd1ff).into()),
icon: Some(rgba(0xfdf6e3ff).into()),
icon_muted: Some(rgba(0x93a1a1ff).into()),
icon_disabled: Some(rgba(0x6f8389ff).into()),
icon_placeholder: Some(rgba(0x93a1a1ff).into()),
icon_accent: Some(rgba(0x288bd1ff).into()),
status_bar_background: Some(rgba(0x083743ff).into()),
title_bar_background: Some(rgba(0x083743ff).into()),
toolbar_background: Some(rgba(0x002b36ff).into()),
tab_bar_background: Some(rgba(0x04313cff).into()),
tab_inactive_background: Some(rgba(0x04313cff).into()),
tab_active_background: Some(rgba(0x002b36ff).into()),
scrollbar_thumb_background: Some(rgba(0xfdf6e34c).into()),
scrollbar_thumb_hover_background: Some(rgba(0x063541ff).into()),
scrollbar_thumb_border: Some(rgba(0x063541ff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0x032f3bff).into()),
editor_foreground: Some(rgba(0xfdf6e3ff).into()),
editor_background: Some(rgba(0x002b36ff).into()),
editor_gutter_background: Some(rgba(0x002b36ff).into()),
editor_subheader_background: Some(rgba(0x04313cff).into()),
editor_active_line_background: Some(rgba(0x04313cbf).into()),
editor_highlighted_line_background: Some(rgba(0x04313cff).into()),
editor_line_number: Some(rgba(0xfdf6e359).into()),
editor_active_line_number: Some(rgba(0xfdf6e3ff).into()),
editor_invisible: Some(rgba(0x6d8288ff).into()),
editor_wrap_guide: Some(rgba(0xfdf6e30d).into()),
editor_active_wrap_guide: Some(rgba(0xfdf6e31a).into()),
editor_document_highlight_read_background: Some(rgba(0x288bd11a).into()),
editor_document_highlight_write_background: Some(rgba(0x6d828866).into()),
terminal_background: Some(rgba(0x002b36ff).into()),
terminal_foreground: Some(rgba(0xfdf6e3ff).into()),
terminal_bright_foreground: Some(rgba(0xfdf6e3ff).into()),
terminal_dim_foreground: Some(rgba(0x002b36ff).into()),
terminal_ansi_black: Some(rgba(0x002b36ff).into()),
terminal_ansi_bright_black: Some(rgba(0x5c7279ff).into()),
terminal_ansi_dim_black: Some(rgba(0xfdf6e3ff).into()),
terminal_ansi_red: Some(rgba(0xdc3330ff).into()),
terminal_ansi_bright_red: Some(rgba(0x7d181cff).into()),
terminal_ansi_dim_red: Some(rgba(0xfaa091ff).into()),
terminal_ansi_green: Some(rgba(0x859904ff).into()),
terminal_ansi_bright_green: Some(rgba(0x434a11ff).into()),
terminal_ansi_dim_green: Some(rgba(0xc6cb8bff).into()),
terminal_ansi_yellow: Some(rgba(0xb58903ff).into()),
terminal_ansi_bright_yellow: Some(rgba(0x5d4310ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0xe1c28aff).into()),
terminal_ansi_blue: Some(rgba(0x288bd1ff).into()),
terminal_ansi_bright_blue: Some(rgba(0x214465ff).into()),
terminal_ansi_dim_blue: Some(rgba(0xa5c3e9ff).into()),
terminal_ansi_magenta: Some(rgba(0xd33782ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0x6f1f40ff).into()),
terminal_ansi_dim_magenta: Some(rgba(0xf0a2bfff).into()),
terminal_ansi_cyan: Some(rgba(0x2ca198ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x204e4aff).into()),
terminal_ansi_dim_cyan: Some(rgba(0x9fd0cbff).into()),
terminal_ansi_white: Some(rgba(0xfdf6e3ff).into()),
terminal_ansi_bright_white: Some(rgba(0xfdf6e3ff).into()),
terminal_ansi_dim_white: Some(rgba(0x7b8e91ff).into()),
link_text_hover: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xb58903ff).into()),
conflict_background: Some(rgba(0x2f1e0cff).into()),
conflict_border: Some(rgba(0x473110ff).into()),
created: Some(rgba(0x859904ff).into()),
created_background: Some(rgba(0x1f210cff).into()),
created_border: Some(rgba(0x323610ff).into()),
deleted: Some(rgba(0xdc3330ff).into()),
deleted_background: Some(rgba(0x4a090fff).into()),
deleted_border: Some(rgba(0x641116ff).into()),
error: Some(rgba(0xdc3330ff).into()),
error_background: Some(rgba(0x4a090fff).into()),
error_border: Some(rgba(0x641116ff).into()),
hidden: Some(rgba(0x6f8389ff).into()),
hidden_background: Some(rgba(0x083743ff).into()),
hidden_border: Some(rgba(0x19424dff).into()),
hint: Some(rgba(0x4f8297ff).into()),
hint_background: Some(rgba(0x141f2cff).into()),
hint_border: Some(rgba(0x1c3249ff).into()),
ignored: Some(rgba(0x93a1a1ff).into()),
ignored_background: Some(rgba(0x083743ff).into()),
ignored_border: Some(rgba(0x2b4f58ff).into()),
info: Some(rgba(0x288bd1ff).into()),
info_background: Some(rgba(0x141f2cff).into()),
info_border: Some(rgba(0x1c3249ff).into()),
modified: Some(rgba(0xb58903ff).into()),
modified_background: Some(rgba(0x2f1e0cff).into()),
modified_border: Some(rgba(0x473110ff).into()),
predictive: Some(rgba(0x40728bff).into()),
predictive_background: Some(rgba(0x1f210cff).into()),
predictive_border: Some(rgba(0x323610ff).into()),
renamed: Some(rgba(0x288bd1ff).into()),
renamed_background: Some(rgba(0x141f2cff).into()),
renamed_border: Some(rgba(0x1c3249ff).into()),
success: Some(rgba(0x859904ff).into()),
success_background: Some(rgba(0x1f210cff).into()),
success_border: Some(rgba(0x323610ff).into()),
unreachable: Some(rgba(0x93a1a1ff).into()),
unreachable_background: Some(rgba(0x083743ff).into()),
unreachable_border: Some(rgba(0x2b4f58ff).into()),
warning: Some(rgba(0xb58903ff).into()),
warning_background: Some(rgba(0x2f1e0cff).into()),
warning_border: Some(rgba(0x473110ff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x288bd1ff).into(),
background: rgba(0x288bd1ff).into(),
selection: rgba(0x288bd13d).into(),
},
PlayerColor {
cursor: rgba(0xd33782ff).into(),
background: rgba(0xd33782ff).into(),
selection: rgba(0xd337823d).into(),
},
PlayerColor {
cursor: rgba(0xcb4b17ff).into(),
background: rgba(0xcb4b17ff).into(),
selection: rgba(0xcb4b173d).into(),
},
PlayerColor {
cursor: rgba(0x6c71c4ff).into(),
background: rgba(0x6c71c4ff).into(),
selection: rgba(0x6c71c43d).into(),
},
PlayerColor {
cursor: rgba(0x2ca198ff).into(),
background: rgba(0x2ca198ff).into(),
selection: rgba(0x2ca1983d).into(),
},
PlayerColor {
cursor: rgba(0xdc3330ff).into(),
background: rgba(0xdc3330ff).into(),
selection: rgba(0xdc33303d).into(),
},
PlayerColor {
cursor: rgba(0xb58903ff).into(),
background: rgba(0xb58903ff).into(),
selection: rgba(0xb589033d).into(),
},
PlayerColor {
cursor: rgba(0x859904ff).into(),
background: rgba(0x859904ff).into(),
selection: rgba(0x8599043d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0x99a5a4ff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0x99a5a4ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf6e3ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0xb58903ff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x4f8297ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x40728bff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf6e3ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf6e3ff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xefe9d6ff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0xefe9d6ff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0xefe9d6ff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xefe9d6ff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xefe9d6ff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0x99a5a4ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4b17ff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf6e3ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x2ca198ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xfdf6e3ff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x288bd1ff).into()),
..Default::default()
},
),
],
}),
},
},
UserTheme {
name: "Solarized Light".into(),
appearance: Appearance::Light,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x9faaa8ff).into()),
border_variant: Some(rgba(0xdcdacbff).into()),
border_focused: Some(rgba(0xbfd3efff).into()),
border_selected: Some(rgba(0xbfd3efff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0xb7bdb6ff).into()),
elevated_surface_background: Some(rgba(0xf3eddaff).into()),
surface_background: Some(rgba(0xf3eddaff).into()),
background: Some(rgba(0xcfd0c4ff).into()),
panel_background: Some(rgba(0xf3eddaff).into()),
element_background: Some(rgba(0xf3eddaff).into()),
element_hover: Some(rgba(0xdcdacbff).into()),
element_active: Some(rgba(0xa2aca9ff).into()),
element_selected: Some(rgba(0xa2aca9ff).into()),
element_disabled: Some(rgba(0xf3eddaff).into()),
drop_target_background: Some(rgba(0x34555e80).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0xdcdacbff).into()),
ghost_element_active: Some(rgba(0xa2aca9ff).into()),
ghost_element_selected: Some(rgba(0xa2aca9ff).into()),
ghost_element_disabled: Some(rgba(0xf3eddaff).into()),
text: Some(rgba(0x002b36ff).into()),
text_muted: Some(rgba(0x34555eff).into()),
text_placeholder: Some(rgba(0x6a7f86ff).into()),
text_disabled: Some(rgba(0x6a7f86ff).into()),
text_accent: Some(rgba(0x298bd1ff).into()),
icon: Some(rgba(0x002b36ff).into()),
icon_muted: Some(rgba(0x34555eff).into()),
icon_disabled: Some(rgba(0x6a7f86ff).into()),
icon_placeholder: Some(rgba(0x34555eff).into()),
icon_accent: Some(rgba(0x298bd1ff).into()),
status_bar_background: Some(rgba(0xcfd0c4ff).into()),
title_bar_background: Some(rgba(0xcfd0c4ff).into()),
toolbar_background: Some(rgba(0xfdf6e3ff).into()),
tab_bar_background: Some(rgba(0xf3eddaff).into()),
tab_inactive_background: Some(rgba(0xf3eddaff).into()),
tab_active_background: Some(rgba(0xfdf6e3ff).into()),
scrollbar_thumb_background: Some(rgba(0x002b364c).into()),
scrollbar_thumb_hover_background: Some(rgba(0xdcdacbff).into()),
scrollbar_thumb_border: Some(rgba(0xdcdacbff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0xf5eedbff).into()),
editor_foreground: Some(rgba(0x002b36ff).into()),
editor_background: Some(rgba(0xfdf6e3ff).into()),
editor_gutter_background: Some(rgba(0xfdf6e3ff).into()),
editor_subheader_background: Some(rgba(0xf3eddaff).into()),
editor_active_line_background: Some(rgba(0xf3eddabf).into()),
editor_highlighted_line_background: Some(rgba(0xf3eddaff).into()),
editor_line_number: Some(rgba(0x002b3659).into()),
editor_active_line_number: Some(rgba(0x002b36ff).into()),
editor_invisible: Some(rgba(0x6d8288ff).into()),
editor_wrap_guide: Some(rgba(0x002b360d).into()),
editor_active_wrap_guide: Some(rgba(0x002b361a).into()),
editor_document_highlight_read_background: Some(rgba(0x298bd11a).into()),
editor_document_highlight_write_background: Some(rgba(0x6d828866).into()),
terminal_background: Some(rgba(0xfdf6e3ff).into()),
terminal_foreground: Some(rgba(0x002b36ff).into()),
terminal_bright_foreground: Some(rgba(0x002b36ff).into()),
terminal_dim_foreground: Some(rgba(0xfdf6e3ff).into()),
terminal_ansi_black: Some(rgba(0xfdf6e3ff).into()),
terminal_ansi_bright_black: Some(rgba(0x7b8e91ff).into()),
terminal_ansi_dim_black: Some(rgba(0x002b36ff).into()),
terminal_ansi_red: Some(rgba(0xdc3330ff).into()),
terminal_ansi_bright_red: Some(rgba(0xfaa091ff).into()),
terminal_ansi_dim_red: Some(rgba(0x7d181cff).into()),
terminal_ansi_green: Some(rgba(0x859904ff).into()),
terminal_ansi_bright_green: Some(rgba(0xc6cb8bff).into()),
terminal_ansi_dim_green: Some(rgba(0x434a11ff).into()),
terminal_ansi_yellow: Some(rgba(0xb58904ff).into()),
terminal_ansi_bright_yellow: Some(rgba(0xe1c28aff).into()),
terminal_ansi_dim_yellow: Some(rgba(0x5d4310ff).into()),
terminal_ansi_blue: Some(rgba(0x298bd1ff).into()),
terminal_ansi_bright_blue: Some(rgba(0xa5c3e9ff).into()),
terminal_ansi_dim_blue: Some(rgba(0x214465ff).into()),
terminal_ansi_magenta: Some(rgba(0xd33882ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0xf0a2bfff).into()),
terminal_ansi_dim_magenta: Some(rgba(0x6f1f40ff).into()),
terminal_ansi_cyan: Some(rgba(0x2ca198ff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x9fd0cbff).into()),
terminal_ansi_dim_cyan: Some(rgba(0x204e4aff).into()),
terminal_ansi_white: Some(rgba(0x002b36ff).into()),
terminal_ansi_bright_white: Some(rgba(0x002b36ff).into()),
terminal_ansi_dim_white: Some(rgba(0x5c7279ff).into()),
link_text_hover: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xb58904ff).into()),
conflict_background: Some(rgba(0xf5e6d0ff).into()),
conflict_border: Some(rgba(0xebd3aaff).into()),
created: Some(rgba(0x859904ff).into()),
created_background: Some(rgba(0xe9ead0ff).into()),
created_border: Some(rgba(0xd6d9abff).into()),
deleted: Some(rgba(0xdc3330ff).into()),
deleted_background: Some(rgba(0xffd9d2ff).into()),
deleted_border: Some(rgba(0xffbbafff).into()),
error: Some(rgba(0xdc3330ff).into()),
error_background: Some(rgba(0xffd9d2ff).into()),
error_border: Some(rgba(0xffbbafff).into()),
hidden: Some(rgba(0x6a7f86ff).into()),
hidden_background: Some(rgba(0xcfd0c4ff).into()),
hidden_border: Some(rgba(0xb7bdb6ff).into()),
hint: Some(rgba(0x5889a3ff).into()),
hint_background: Some(rgba(0xdbe6f6ff).into()),
hint_border: Some(rgba(0xbfd3efff).into()),
ignored: Some(rgba(0x34555eff).into()),
ignored_background: Some(rgba(0xcfd0c4ff).into()),
ignored_border: Some(rgba(0x9faaa8ff).into()),
info: Some(rgba(0x298bd1ff).into()),
info_background: Some(rgba(0xdbe6f6ff).into()),
info_border: Some(rgba(0xbfd3efff).into()),
modified: Some(rgba(0xb58904ff).into()),
modified_background: Some(rgba(0xf5e6d0ff).into()),
modified_border: Some(rgba(0xebd3aaff).into()),
predictive: Some(rgba(0x679aafff).into()),
predictive_background: Some(rgba(0xe9ead0ff).into()),
predictive_border: Some(rgba(0xd6d9abff).into()),
renamed: Some(rgba(0x298bd1ff).into()),
renamed_background: Some(rgba(0xdbe6f6ff).into()),
renamed_border: Some(rgba(0xbfd3efff).into()),
success: Some(rgba(0x859904ff).into()),
success_background: Some(rgba(0xe9ead0ff).into()),
success_border: Some(rgba(0xd6d9abff).into()),
unreachable: Some(rgba(0x34555eff).into()),
unreachable_background: Some(rgba(0xcfd0c4ff).into()),
unreachable_border: Some(rgba(0x9faaa8ff).into()),
warning: Some(rgba(0xb58904ff).into()),
warning_background: Some(rgba(0xf5e6d0ff).into()),
warning_border: Some(rgba(0xebd3aaff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x298bd1ff).into(),
background: rgba(0x298bd1ff).into(),
selection: rgba(0x298bd13d).into(),
},
PlayerColor {
cursor: rgba(0xd33882ff).into(),
background: rgba(0xd33882ff).into(),
selection: rgba(0xd338823d).into(),
},
PlayerColor {
cursor: rgba(0xcb4c18ff).into(),
background: rgba(0xcb4c18ff).into(),
selection: rgba(0xcb4c183d).into(),
},
PlayerColor {
cursor: rgba(0x6d71c4ff).into(),
background: rgba(0x6d71c4ff).into(),
selection: rgba(0x6d71c43d).into(),
},
PlayerColor {
cursor: rgba(0x2ca198ff).into(),
background: rgba(0x2ca198ff).into(),
selection: rgba(0x2ca1983d).into(),
},
PlayerColor {
cursor: rgba(0xdc3330ff).into(),
background: rgba(0xdc3330ff).into(),
selection: rgba(0xdc33303d).into(),
},
PlayerColor {
cursor: rgba(0xb58904ff).into(),
background: rgba(0xb58904ff).into(),
selection: rgba(0xb589043d).into(),
},
PlayerColor {
cursor: rgba(0x859904ff).into(),
background: rgba(0x859904ff).into(),
selection: rgba(0x8599043d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0x30525bff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0x30525bff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0x002b36ff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0xb58904ff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x5889a3ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0x859904ff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x679aafff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0x002b36ff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0x002b36ff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0x05333eff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0x05333eff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0x05333eff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0x05333eff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0x05333eff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0x30525bff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xcb4c18ff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0x002b36ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x2ca198ff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0x002b36ff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x298bd1ff).into()),
..Default::default()
},
),
],
}),
},
},
],
}
}

View File

@ -1,473 +0,0 @@
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
pub fn summercamp() -> UserThemeFamily {
UserThemeFamily {
name: "Summercamp".into(),
author: "Zed Industries".into(),
themes: vec![UserTheme {
name: "Summercamp".into(),
appearance: Appearance::Dark,
styles: UserThemeStylesRefinement {
colors: ThemeColorsRefinement {
border: Some(rgba(0x312d21ff).into()),
border_variant: Some(rgba(0x29251bff).into()),
border_focused: Some(rgba(0x193761ff).into()),
border_selected: Some(rgba(0x193761ff).into()),
border_transparent: Some(rgba(0x00000000).into()),
border_disabled: Some(rgba(0x2e2a1fff).into()),
elevated_surface_background: Some(rgba(0x231f16ff).into()),
surface_background: Some(rgba(0x231f16ff).into()),
background: Some(rgba(0x2a261cff).into()),
panel_background: Some(rgba(0x231f16ff).into()),
element_background: Some(rgba(0x231f16ff).into()),
element_hover: Some(rgba(0x29251bff).into()),
element_active: Some(rgba(0x302c20ff).into()),
element_selected: Some(rgba(0x302c20ff).into()),
element_disabled: Some(rgba(0x231f16ff).into()),
drop_target_background: Some(rgba(0x736e5580).into()),
ghost_element_background: Some(rgba(0x00000000).into()),
ghost_element_hover: Some(rgba(0x29251bff).into()),
ghost_element_active: Some(rgba(0x302c20ff).into()),
ghost_element_selected: Some(rgba(0x302c20ff).into()),
ghost_element_disabled: Some(rgba(0x231f16ff).into()),
text: Some(rgba(0xf8f5deff).into()),
text_muted: Some(rgba(0x736e55ff).into()),
text_placeholder: Some(rgba(0x4c4735ff).into()),
text_disabled: Some(rgba(0x4c4735ff).into()),
text_accent: Some(rgba(0x499befff).into()),
icon: Some(rgba(0xf8f5deff).into()),
icon_muted: Some(rgba(0x736e55ff).into()),
icon_disabled: Some(rgba(0x4c4735ff).into()),
icon_placeholder: Some(rgba(0x736e55ff).into()),
icon_accent: Some(rgba(0x499befff).into()),
status_bar_background: Some(rgba(0x2a261cff).into()),
title_bar_background: Some(rgba(0x2a261cff).into()),
toolbar_background: Some(rgba(0x1c1810ff).into()),
tab_bar_background: Some(rgba(0x231f16ff).into()),
tab_inactive_background: Some(rgba(0x231f16ff).into()),
tab_active_background: Some(rgba(0x1c1810ff).into()),
scrollbar_thumb_background: Some(rgba(0xf8f5de4c).into()),
scrollbar_thumb_hover_background: Some(rgba(0x29251bff).into()),
scrollbar_thumb_border: Some(rgba(0x29251bff).into()),
scrollbar_track_background: Some(rgba(0x00000000).into()),
scrollbar_track_border: Some(rgba(0x221e15ff).into()),
editor_foreground: Some(rgba(0xf8f5deff).into()),
editor_background: Some(rgba(0x1c1810ff).into()),
editor_gutter_background: Some(rgba(0x1c1810ff).into()),
editor_subheader_background: Some(rgba(0x231f16ff).into()),
editor_active_line_background: Some(rgba(0x231f16bf).into()),
editor_highlighted_line_background: Some(rgba(0x231f16ff).into()),
editor_line_number: Some(rgba(0xf8f5de59).into()),
editor_active_line_number: Some(rgba(0xf8f5deff).into()),
editor_invisible: Some(rgba(0x494433ff).into()),
editor_wrap_guide: Some(rgba(0xf8f5de0d).into()),
editor_active_wrap_guide: Some(rgba(0xf8f5de1a).into()),
editor_document_highlight_read_background: Some(rgba(0x499bef1a).into()),
editor_document_highlight_write_background: Some(rgba(0x49443366).into()),
terminal_background: Some(rgba(0x1c1810ff).into()),
terminal_foreground: Some(rgba(0xf8f5deff).into()),
terminal_bright_foreground: Some(rgba(0xf8f5deff).into()),
terminal_dim_foreground: Some(rgba(0x1c1810ff).into()),
terminal_ansi_black: Some(rgba(0x1c1810ff).into()),
terminal_ansi_bright_black: Some(rgba(0x3b3627ff).into()),
terminal_ansi_dim_black: Some(rgba(0xf8f5deff).into()),
terminal_ansi_red: Some(rgba(0xe35142ff).into()),
terminal_ansi_bright_red: Some(rgba(0x7f2724ff).into()),
terminal_ansi_dim_red: Some(rgba(0xfbab9cff).into()),
terminal_ansi_green: Some(rgba(0x5dea5aff).into()),
terminal_ansi_bright_green: Some(rgba(0x28842cff).into()),
terminal_ansi_dim_green: Some(rgba(0xb9f7aeff).into()),
terminal_ansi_yellow: Some(rgba(0xf1fe29ff).into()),
terminal_ansi_bright_yellow: Some(rgba(0x8c9a10ff).into()),
terminal_ansi_dim_yellow: Some(rgba(0xffffa2ff).into()),
terminal_ansi_blue: Some(rgba(0x499befff).into()),
terminal_ansi_bright_blue: Some(rgba(0x234b7fff).into()),
terminal_ansi_dim_blue: Some(rgba(0xb1ccf8ff).into()),
terminal_ansi_magenta: Some(rgba(0xf59be6ff).into()),
terminal_ansi_bright_magenta: Some(rgba(0x88487eff).into()),
terminal_ansi_dim_magenta: Some(rgba(0xfccef3ff).into()),
terminal_ansi_cyan: Some(rgba(0x5beabcff).into()),
terminal_ansi_bright_cyan: Some(rgba(0x298462ff).into()),
terminal_ansi_dim_cyan: Some(rgba(0xb7f6ddff).into()),
terminal_ansi_white: Some(rgba(0xf8f5deff).into()),
terminal_ansi_bright_white: Some(rgba(0xf8f5deff).into()),
terminal_ansi_dim_white: Some(rgba(0x57533fff).into()),
link_text_hover: Some(rgba(0x499befff).into()),
..Default::default()
},
status: StatusColorsRefinement {
conflict: Some(rgba(0xf1fe29ff).into()),
conflict_background: Some(rgba(0x556305ff).into()),
conflict_border: Some(rgba(0x727f0aff).into()),
created: Some(rgba(0x5dea5aff).into()),
created_background: Some(rgba(0x0a4d13ff).into()),
created_border: Some(rgba(0x1a6a20ff).into()),
deleted: Some(rgba(0xe35142ff).into()),
deleted_background: Some(rgba(0x491013ff).into()),
deleted_border: Some(rgba(0x651c1cff).into()),
error: Some(rgba(0xe35142ff).into()),
error_background: Some(rgba(0x491013ff).into()),
error_border: Some(rgba(0x651c1cff).into()),
hidden: Some(rgba(0x4c4735ff).into()),
hidden_background: Some(rgba(0x2a261cff).into()),
hidden_border: Some(rgba(0x2e2a1fff).into()),
hint: Some(rgba(0x246e61ff).into()),
hint_background: Some(rgba(0x0e2242ff).into()),
hint_border: Some(rgba(0x193761ff).into()),
ignored: Some(rgba(0x736e55ff).into()),
ignored_background: Some(rgba(0x2a261cff).into()),
ignored_border: Some(rgba(0x312d21ff).into()),
info: Some(rgba(0x499befff).into()),
info_background: Some(rgba(0x0e2242ff).into()),
info_border: Some(rgba(0x193761ff).into()),
modified: Some(rgba(0xf1fe29ff).into()),
modified_background: Some(rgba(0x556305ff).into()),
modified_border: Some(rgba(0x727f0aff).into()),
predictive: Some(rgba(0x79434bff).into()),
predictive_background: Some(rgba(0x0a4d13ff).into()),
predictive_border: Some(rgba(0x1a6a20ff).into()),
renamed: Some(rgba(0x499befff).into()),
renamed_background: Some(rgba(0x0e2242ff).into()),
renamed_border: Some(rgba(0x193761ff).into()),
success: Some(rgba(0x5dea5aff).into()),
success_background: Some(rgba(0x0a4d13ff).into()),
success_border: Some(rgba(0x1a6a20ff).into()),
unreachable: Some(rgba(0x736e55ff).into()),
unreachable_background: Some(rgba(0x2a261cff).into()),
unreachable_border: Some(rgba(0x312d21ff).into()),
warning: Some(rgba(0xf1fe29ff).into()),
warning_background: Some(rgba(0x556305ff).into()),
warning_border: Some(rgba(0x727f0aff).into()),
..Default::default()
},
player: Some(PlayerColors(vec![
PlayerColor {
cursor: rgba(0x499befff).into(),
background: rgba(0x499befff).into(),
selection: rgba(0x499bef3d).into(),
},
PlayerColor {
cursor: rgba(0xf59be6ff).into(),
background: rgba(0xf59be6ff).into(),
selection: rgba(0xf59be63d).into(),
},
PlayerColor {
cursor: rgba(0xfaa11dff).into(),
background: rgba(0xfaa11dff).into(),
selection: rgba(0xfaa11d3d).into(),
},
PlayerColor {
cursor: rgba(0xfe8080ff).into(),
background: rgba(0xfe8080ff).into(),
selection: rgba(0xfe80803d).into(),
},
PlayerColor {
cursor: rgba(0x5beabcff).into(),
background: rgba(0x5beabcff).into(),
selection: rgba(0x5beabc3d).into(),
},
PlayerColor {
cursor: rgba(0xe35142ff).into(),
background: rgba(0xe35142ff).into(),
selection: rgba(0xe351423d).into(),
},
PlayerColor {
cursor: rgba(0xf1fe29ff).into(),
background: rgba(0xf1fe29ff).into(),
selection: rgba(0xf1fe293d).into(),
},
PlayerColor {
cursor: rgba(0x5dea5aff).into(),
background: rgba(0x5dea5aff).into(),
selection: rgba(0x5dea5a3d).into(),
},
])),
syntax: Some(UserSyntaxTheme {
highlights: vec![
(
"attribute".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"boolean".into(),
UserHighlightStyle {
color: Some(rgba(0x5dea5aff).into()),
..Default::default()
},
),
(
"comment".into(),
UserHighlightStyle {
color: Some(rgba(0x777259ff).into()),
..Default::default()
},
),
(
"comment.doc".into(),
UserHighlightStyle {
color: Some(rgba(0x777259ff).into()),
..Default::default()
},
),
(
"constant".into(),
UserHighlightStyle {
color: Some(rgba(0x5dea5aff).into()),
..Default::default()
},
),
(
"constructor".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"embedded".into(),
UserHighlightStyle {
color: Some(rgba(0xf8f5deff).into()),
..Default::default()
},
),
(
"emphasis".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"emphasis.strong".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"enum".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"function".into(),
UserHighlightStyle {
color: Some(rgba(0xf1fe29ff).into()),
..Default::default()
},
),
(
"hint".into(),
UserHighlightStyle {
color: Some(rgba(0x246e61ff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"keyword".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"label".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"link_text".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"link_uri".into(),
UserHighlightStyle {
color: Some(rgba(0x5dea5aff).into()),
..Default::default()
},
),
(
"number".into(),
UserHighlightStyle {
color: Some(rgba(0x5dea5aff).into()),
..Default::default()
},
),
(
"operator".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"predictive".into(),
UserHighlightStyle {
color: Some(rgba(0x79434bff).into()),
font_style: Some(UserFontStyle::Italic),
..Default::default()
},
),
(
"preproc".into(),
UserHighlightStyle {
color: Some(rgba(0xf8f5deff).into()),
..Default::default()
},
),
(
"primary".into(),
UserHighlightStyle {
color: Some(rgba(0xf8f5deff).into()),
..Default::default()
},
),
(
"property".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"punctuation".into(),
UserHighlightStyle {
color: Some(rgba(0xbfbb9bff).into()),
..Default::default()
},
),
(
"punctuation.bracket".into(),
UserHighlightStyle {
color: Some(rgba(0xbfbb9bff).into()),
..Default::default()
},
),
(
"punctuation.delimiter".into(),
UserHighlightStyle {
color: Some(rgba(0xbfbb9bff).into()),
..Default::default()
},
),
(
"punctuation.list_marker".into(),
UserHighlightStyle {
color: Some(rgba(0xbfbb9bff).into()),
..Default::default()
},
),
(
"punctuation.special".into(),
UserHighlightStyle {
color: Some(rgba(0xbfbb9bff).into()),
..Default::default()
},
),
(
"string".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"string.escape".into(),
UserHighlightStyle {
color: Some(rgba(0x777259ff).into()),
..Default::default()
},
),
(
"string.regex".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"string.special".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"string.special.symbol".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"tag".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
(
"text.literal".into(),
UserHighlightStyle {
color: Some(rgba(0xfaa11dff).into()),
..Default::default()
},
),
(
"title".into(),
UserHighlightStyle {
color: Some(rgba(0xf8f5deff).into()),
font_weight: Some(UserFontWeight(700.0)),
..Default::default()
},
),
(
"type".into(),
UserHighlightStyle {
color: Some(rgba(0x5beabcff).into()),
..Default::default()
},
),
(
"variable".into(),
UserHighlightStyle {
color: Some(rgba(0xf8f5deff).into()),
..Default::default()
},
),
(
"variant".into(),
UserHighlightStyle {
color: Some(rgba(0x499befff).into()),
..Default::default()
},
),
],
}),
},
}],
}
}

View File

@ -1,97 +0,0 @@
use crate::{
Appearance, PlayerColors, StatusColors, StatusColorsRefinement, ThemeColors,
ThemeColorsRefinement,
};
use gpui::{FontStyle, FontWeight, Hsla};
use refineable::Refineable;
use serde::Deserialize;
#[derive(Deserialize)]
pub struct UserThemeFamily {
pub name: String,
pub author: String,
pub themes: Vec<UserTheme>,
}
#[derive(Deserialize)]
pub struct UserTheme {
pub name: String,
pub appearance: Appearance,
pub styles: UserThemeStylesRefinement,
}
#[derive(Refineable, Clone)]
#[refineable(Deserialize)]
pub struct UserThemeStyles {
#[refineable]
pub colors: ThemeColors,
#[refineable]
pub status: StatusColors,
pub player: PlayerColors,
pub syntax: UserSyntaxTheme,
}
#[derive(Clone, Default, Deserialize)]
pub struct UserSyntaxTheme {
pub highlights: Vec<(String, UserHighlightStyle)>,
}
#[derive(Clone, Default, Deserialize)]
pub struct UserHighlightStyle {
pub color: Option<Hsla>,
pub font_style: Option<UserFontStyle>,
pub font_weight: Option<UserFontWeight>,
}
#[derive(Clone, Copy, Default, Deserialize)]
pub struct UserFontWeight(pub f32);
impl UserFontWeight {
/// Thin weight (100), the thinnest value.
pub const THIN: Self = Self(FontWeight::THIN.0);
/// Extra light weight (200).
pub const EXTRA_LIGHT: Self = Self(FontWeight::EXTRA_LIGHT.0);
/// Light weight (300).
pub const LIGHT: Self = Self(FontWeight::LIGHT.0);
/// Normal (400).
pub const NORMAL: Self = Self(FontWeight::NORMAL.0);
/// Medium weight (500, higher than normal).
pub const MEDIUM: Self = Self(FontWeight::MEDIUM.0);
/// Semibold weight (600).
pub const SEMIBOLD: Self = Self(FontWeight::SEMIBOLD.0);
/// Bold weight (700).
pub const BOLD: Self = Self(FontWeight::BOLD.0);
/// Extra-bold weight (800).
pub const EXTRA_BOLD: Self = Self(FontWeight::EXTRA_BOLD.0);
/// Black weight (900), the thickest value.
pub const BLACK: Self = Self(FontWeight::BLACK.0);
}
impl From<UserFontWeight> for FontWeight {
fn from(value: UserFontWeight) -> Self {
Self(value.0)
}
}
#[derive(Debug, Clone, Copy, Deserialize)]
pub enum UserFontStyle {
Normal,
Italic,
Oblique,
}
impl From<UserFontStyle> for FontStyle {
fn from(value: UserFontStyle) -> Self {
match value {
UserFontStyle::Normal => FontStyle::Normal,
UserFontStyle::Italic => FontStyle::Italic,
UserFontStyle::Oblique => FontStyle::Oblique,
}
}
}
impl UserHighlightStyle {
pub fn is_empty(&self) -> bool {
self.color.is_none() && self.font_style.is_none() && self.font_weight.is_none()
}
}

View File

@ -23,5 +23,5 @@ serde.workspace = true
serde_json.workspace = true
simplelog = "0.9"
strum = { version = "0.25.0", features = ["derive"] }
theme = { path = "../theme", features = [] }
theme = { path = "../theme" }
uuid.workspace = true

View File

@ -1,124 +1 @@
# Zed Theme Importer
---
## Usage
- `cargo run -p theme_importer` - Import the context of `assets/themes/src`
---
## Troubleshooting
As the importer generates rust files, you may need to manually do some cleanup in `registry.rs` and `themes/mod.rs` if you remove themes or delete the `themes` folder in the theme crate.
---
## Required Structure
To import a theme or series of themes 3 things are required:
- `family.json`: A JSON file containing the theme family metadata and list of theme variants
- `{theme_name}.json`: One theme json for each theme variant
- `LICENSE`: A license file for the theme family
### `family.json`
#### `name`
The name of the theme family. Avoid special characters.
This will be used for the theme family directory name (lowercased) and the theme family name in the Zed UI.
Good:
- `Rose Pine`
- `Synthwave 84`
- `Monokai Solarized`
Bad:
- `Rosé Pine`
- `Synthwave '84`
- `Monokai (Solarized)`
#### `author`
The author of the theme family. This can be a name or a username.
This will be used for the theme family author in the Zed UI.
#### `themes`
A list of theme variants.
`appearance` can be either `light` or `dark`. This will impact which default fallback colors are used, and where the theme shows up in the Zed UI.
### `{theme_name}.json`
Each theme added to the family must have a corresponding JSON file. This JSON file can be obtained from the VSCode extensions folder (once you have installed it.) This is usually located at `~/.vscode/extensions` (on macOS).
You can use `open ~/.vscode/extensions` to open the folder in Finder directly.
Copy that json file into the theme family directory and tidy up the filenames as needed.
### `LICENSE`
A LICENSE file is required to import a theme family. Failing to provide a complete text license will cause it to be skipped when the import is run.
If the theme only provides a license code (e.g. MIT, Apache 2.0, etc.) then put that code into the LICENSE file.
If no license is provided, either contact the theme creator or don't add the theme.
---
### Complete Example:
An example family with multiple variants:
```json
{
"name": "Ayu",
// When both name and username are available
// prefer the `username (name)` format
"author": "dempfi (Ike Ku)",
"themes": [
{
"name": "Ayu Light",
"file_name": "ayu-light.json",
"appearance": "light"
},
{
"name": "Ayu Mirage",
"file_name": "ayu-mirage.json",
"appearance": "dark"
},
{
"name": "Ayu Dark",
"file_name": "ayu-dark.json",
"appearance": "dark"
}
]
}
```
An example single variant family:
```json
{
"name": "Andromeda",
"author": "Eliver Lara (EliverLara)",
"themes": [
{
"name": "Andromeda",
"file_name": "andromeda.json",
"appearance": "dark"
},
{
"name": "Andromeda Bordered",
"file_name": "andromeda-bordered.json",
"appearance": "dark"
}
]
}
```

View File

@ -2,6 +2,7 @@ use anyhow::Result;
use gpui::Hsla;
use palette::FromColor;
#[allow(unused)]
pub(crate) fn try_parse_color(color: &str) -> Result<Hsla> {
let rgba = gpui::Rgba::try_from(color)?;
let rgba = palette::rgb::Srgba::from_components((rgba.r, rgba.g, rgba.b, rgba.a));
@ -17,6 +18,7 @@ pub(crate) fn try_parse_color(color: &str) -> Result<Hsla> {
Ok(hsla)
}
#[allow(unused)]
pub(crate) fn pack_color(color: Hsla) -> u32 {
let hsla = palette::Hsla::from_components((color.h * 360., color.s, color.l, color.a));
let rgba = palette::rgb::Srgba::from_color(hsla);

View File

@ -1,39 +1,22 @@
mod assets;
mod color;
mod theme_printer;
mod util;
mod vscode;
mod zed1;
use std::collections::HashMap;
use std::fs::{self, File};
use std::io::Write;
use std::fs::File;
use std::path::PathBuf;
use std::process::Command;
use std::str::FromStr;
use any_ascii::any_ascii;
use anyhow::{anyhow, Context, Result};
use anyhow::{Context, Result};
use clap::Parser;
use convert_case::{Case, Casing};
use gpui::Hsla;
use indexmap::IndexMap;
use indoc::formatdoc;
use json_comments::StripComments;
use log::LevelFilter;
use serde::Deserialize;
use simplelog::{TermLogger, TerminalMode};
use theme::{
Appearance, FontWeightContent, HighlightStyleContent, PlayerColorContent, StatusColorsContent,
ThemeColorsContent, ThemeContent, ThemeFamilyContent, ThemeStyleContent, UserTheme,
UserThemeFamily,
};
use theme::{Appearance, AppearanceContent};
use crate::theme_printer::UserThemeFamilyPrinter;
use crate::vscode::VsCodeTheme;
use crate::vscode::VsCodeThemeConverter;
use crate::zed1::theme::Theme as Zed1Theme;
use crate::zed1::{zed1_theme_licenses, Zed1ThemeConverter};
#[derive(Debug, Deserialize)]
struct FamilyMetadata {
@ -57,6 +40,15 @@ pub enum ThemeAppearanceJson {
Dark,
}
impl From<ThemeAppearanceJson> for AppearanceContent {
fn from(value: ThemeAppearanceJson) -> Self {
match value {
ThemeAppearanceJson::Light => Self::Light,
ThemeAppearanceJson::Dark => Self::Dark,
}
}
}
impl From<ThemeAppearanceJson> for Appearance {
fn from(value: ThemeAppearanceJson) -> Self {
match value {
@ -76,15 +68,15 @@ pub struct ThemeMetadata {
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
/// The path to the theme to import.
theme_path: PathBuf,
/// Whether to warn when values are missing from the theme.
#[arg(long)]
warn_on_missing: bool,
}
fn main() -> Result<()> {
const SOURCE_PATH: &str = "assets/themes/src/vscode";
const OUT_PATH: &str = "crates/theme/src/themes";
let args = Args::parse();
let log_config = {
@ -105,606 +97,35 @@ fn main() -> Result<()> {
TermLogger::init(LevelFilter::Trace, log_config, TerminalMode::Mixed)
.expect("could not initialize logger");
if 1 < 2 {
let themes: Vec<UserThemeFamily> = Vec::new();
// Uncomment this line when you need to regenerate themes.
// let themes = theme::all_user_themes();
let theme_file_path = args.theme_path;
let mut families = Vec::new();
for family in themes {
families.push(convert_family(family));
let theme_file = match File::open(&theme_file_path) {
Ok(file) => file,
Err(err) => {
log::info!("Failed to open file at path: {:?}", theme_file_path);
return Err(err)?;
}
};
for family in families {
let theme_family_slug = any_ascii(&family.name)
.replace("(", "")
.replace(")", "")
.to_case(Case::Snake);
let theme_without_comments = StripComments::new(theme_file);
let vscode_theme: VsCodeTheme = serde_json::from_reader(theme_without_comments)
.context(format!("failed to parse theme {theme_file_path:?}"))?;
let output_dir = PathBuf::from("assets/themes/").join(&theme_family_slug);
let theme_metadata = ThemeMetadata {
name: "".to_string(),
appearance: ThemeAppearanceJson::Dark,
file_name: "".to_string(),
};
fs::create_dir_all(&output_dir)?;
let converter = VsCodeThemeConverter::new(vscode_theme, theme_metadata, IndexMap::new());
let mut output_file =
File::create(output_dir.join(format!("{theme_family_slug}.json")))?;
let theme = converter.convert()?;
let theme_json = serde_json::to_string_pretty(&family).unwrap();
let theme_json = serde_json::to_string_pretty(&theme).unwrap();
output_file.write_all(format!("{theme_json}\n").as_bytes())?;
}
return Ok(());
}
let mut theme_families = Vec::new();
/// Whether VS Code themes should be imported.
const IMPORT_VS_CODE_THEMES: bool = false;
if IMPORT_VS_CODE_THEMES {
log::info!("Loading themes source...");
let vscode_themes_path = PathBuf::from_str(SOURCE_PATH)?;
if !vscode_themes_path.exists() {
return Err(anyhow!(format!(
"Couldn't find {}, make sure it exists",
SOURCE_PATH
)));
}
for theme_family_dir in fs::read_dir(&vscode_themes_path)? {
let theme_family_dir = theme_family_dir?;
if !theme_family_dir.file_type()?.is_dir() {
continue;
}
let theme_family_slug = theme_family_dir
.path()
.file_stem()
.ok_or(anyhow!("no file stem"))
.map(|stem| stem.to_string_lossy().to_string())?;
let family_metadata_file = File::open(theme_family_dir.path().join("family.json"))
.context(format!(
"no `family.json` found for '{}'",
theme_family_slug
))?;
let license_file_path = theme_family_dir.path().join("LICENSE");
if !license_file_path.exists() {
log::info!("Skipping theme family '{}' because it does not have a LICENSE file. This theme will only be imported once a LICENSE file is provided.", theme_family_slug);
continue;
}
let family_metadata: FamilyMetadata = serde_json::from_reader(family_metadata_file)
.context(format!(
"failed to parse `family.json` for '{theme_family_slug}'"
))?;
let mut themes = Vec::new();
for theme_metadata in family_metadata.themes {
log::info!("Converting '{}' theme", &theme_metadata.name);
let theme_file_path = theme_family_dir.path().join(&theme_metadata.file_name);
let theme_file = match File::open(&theme_file_path) {
Ok(file) => file,
Err(_) => {
log::info!("Failed to open file at path: {:?}", theme_file_path);
continue;
}
};
let theme_without_comments = StripComments::new(theme_file);
let vscode_theme: VsCodeTheme = serde_json::from_reader(theme_without_comments)
.context(format!("failed to parse theme {theme_file_path:?}"))?;
let converter = VsCodeThemeConverter::new(
vscode_theme,
theme_metadata,
family_metadata.syntax.clone(),
);
let theme = converter.convert()?;
themes.push(theme);
}
let theme_family = UserThemeFamily {
name: family_metadata.name.into(),
author: family_metadata.author.into(),
themes,
};
theme_families.push(theme_family);
}
}
let zed1_themes_path = PathBuf::from_str("assets/themes")?;
let zed1_theme_families = [
"Andromeda",
"Atelier",
"Ayu",
"Gruvbox",
"One",
"Rosé Pine",
"Sandcastle",
"Solarized",
"Summercamp",
];
let zed1_licenses_by_theme: HashMap<String, zed1::Zed1ThemeLicense> = HashMap::from_iter(
zed1_theme_licenses()
.into_iter()
.map(|theme_license| (theme_license.theme.clone(), theme_license)),
);
let mut zed1_themes_by_family: IndexMap<String, Vec<UserTheme>> = IndexMap::from_iter(
zed1_theme_families
.into_iter()
.map(|family| (family.to_string(), Vec::new())),
);
for entry in fs::read_dir(&zed1_themes_path)? {
let entry = entry?;
if entry.file_type()?.is_dir() {
continue;
}
match entry.path().extension() {
None => continue,
Some(extension) => {
if extension != "json" {
continue;
}
}
}
let theme_file_path = entry.path();
let theme_file = match File::open(&theme_file_path) {
Ok(file) => file,
Err(_) => {
log::info!("Failed to open file at path: {:?}", theme_file_path);
continue;
}
};
let theme_without_comments = StripComments::new(theme_file);
let zed1_theme: Zed1Theme = serde_json::from_reader(theme_without_comments)
.context(format!("failed to parse theme {theme_file_path:?}"))?;
let theme_name = zed1_theme.meta.name.clone();
let converter = Zed1ThemeConverter::new(zed1_theme);
let theme = converter.convert()?;
let Some((_, themes_for_family)) = zed1_themes_by_family
.iter_mut()
.find(|(family, _)| theme_name.starts_with(*family))
else {
log::warn!("No theme family found for '{}'.", theme_name);
continue;
};
themes_for_family.push(theme);
}
zed1_themes_by_family.sort_keys();
let mut licenses = Vec::new();
for (family, themes) in zed1_themes_by_family {
let mut theme_family = UserThemeFamily {
name: family,
author: "Zed Industries".to_string(),
themes,
};
theme_family
.themes
.sort_unstable_by_key(|theme| theme.name.clone());
for theme in &theme_family.themes {
let license = zed1_licenses_by_theme
.get(&theme.name)
.ok_or_else(|| anyhow!("missing license for theme: '{}'", theme.name))?;
let license_header = match license.license_url.as_ref() {
Some(license_url) => {
format!("[{theme_name}]({license_url})", theme_name = theme.name)
}
None => theme.name.clone(),
};
licenses.push(formatdoc!(
"
## {license_header}
{license_text}
********************************************************************************
",
license_text = license.license_text
));
}
theme_families.push(theme_family);
}
let themes_output_path = PathBuf::from_str(OUT_PATH)?;
if !themes_output_path.exists() {
log::info!("Creating directory: {:?}", themes_output_path);
fs::create_dir_all(&themes_output_path)?;
}
let mut mod_rs_file = File::create(themes_output_path.join(format!("mod.rs")))?;
let mut theme_modules = Vec::new();
for theme_family in theme_families {
let theme_family_slug = any_ascii(&theme_family.name)
.replace("(", "")
.replace(")", "")
.to_case(Case::Snake);
let mut output_file =
File::create(themes_output_path.join(format!("{theme_family_slug}.rs")))?;
log::info!(
"Creating file: {:?}",
themes_output_path.join(format!("{theme_family_slug}.rs"))
);
let theme_module = format!(
r#"
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
use gpui::rgba;
#[allow(unused)]
use crate::{{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, ThemeColorsRefinement,
UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement,
UserFontWeight, UserFontStyle
}};
pub fn {theme_family_slug}() -> UserThemeFamily {{
{theme_family_definition}
}}
"#,
theme_family_definition = format!("{:#?}", UserThemeFamilyPrinter::new(theme_family))
);
output_file.write_all(theme_module.as_bytes())?;
theme_modules.push(theme_family_slug);
}
theme_modules.sort();
let themes_vector_contents = format!(
r#"
use crate::UserThemeFamily;
pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {{
vec![{all_themes}]
}}
"#,
all_themes = theme_modules
.iter()
.map(|module| format!("{}()", module))
.collect::<Vec<_>>()
.join(", ")
);
let mod_rs_contents = format!(
r#"
// This file was generated by the `theme_importer`.
// Be careful when modifying it by hand.
{mod_statements}
{use_statements}
{themes_vector_contents}
"#,
mod_statements = theme_modules
.iter()
.map(|module| format!("mod {module};"))
.collect::<Vec<_>>()
.join("\n"),
use_statements = theme_modules
.iter()
.map(|module| format!("pub use {module}::*;"))
.collect::<Vec<_>>()
.join("\n"),
themes_vector_contents = themes_vector_contents
);
mod_rs_file.write_all(mod_rs_contents.as_bytes())?;
log::info!("Writing LICENSES file...");
let mut licenses_file = File::create(themes_output_path.join(format!("LICENSES")))?;
licenses_file.write_all(licenses.join("\n").as_bytes())?;
log::info!("Formatting themes...");
let format_result = format_themes_crate()
// We need to format a second time to catch all of the formatting issues.
.and_then(|_| format_themes_crate());
if let Err(err) = format_result {
log::error!("Failed to format themes: {}", err);
}
println!("{}", theme_json);
log::info!("Done!");
Ok(())
}
fn format_themes_crate() -> std::io::Result<std::process::Output> {
Command::new("cargo")
.args(["fmt", "--package", "theme"])
.output()
}
fn convert_family(family: UserThemeFamily) -> ThemeFamilyContent {
ThemeFamilyContent {
name: family.name,
author: family.author,
themes: family.themes.into_iter().map(convert_theme).collect(),
}
}
fn convert_theme(theme: UserTheme) -> ThemeContent {
ThemeContent {
name: theme.name,
appearance: match theme.appearance {
Appearance::Light => theme::AppearanceContent::Light,
Appearance::Dark => theme::AppearanceContent::Dark,
},
style: convert_theme_styles(theme.styles),
}
}
fn serialize_color(color: Hsla) -> String {
let rgba = color.to_rgb();
format!("#{:08x}", u32::from(rgba))
}
fn convert_theme_styles(styles: theme::UserThemeStylesRefinement) -> ThemeStyleContent {
ThemeStyleContent {
colors: ThemeColorsContent {
border: styles.colors.border.map(serialize_color),
border_variant: styles.colors.border_variant.map(serialize_color),
border_focused: styles.colors.border_focused.map(serialize_color),
border_selected: styles.colors.border_selected.map(serialize_color),
border_transparent: styles.colors.border_transparent.map(serialize_color),
border_disabled: styles.colors.border_disabled.map(serialize_color),
elevated_surface_background: styles
.colors
.elevated_surface_background
.map(serialize_color),
surface_background: styles.colors.surface_background.map(serialize_color),
background: styles.colors.background.map(serialize_color),
element_background: styles.colors.element_background.map(serialize_color),
element_hover: styles.colors.element_hover.map(serialize_color),
element_active: styles.colors.element_active.map(serialize_color),
element_selected: styles.colors.element_selected.map(serialize_color),
element_disabled: styles.colors.element_disabled.map(serialize_color),
drop_target_background: styles.colors.drop_target_background.map(serialize_color),
ghost_element_background: styles.colors.ghost_element_background.map(serialize_color),
ghost_element_hover: styles.colors.ghost_element_hover.map(serialize_color),
ghost_element_active: styles.colors.ghost_element_active.map(serialize_color),
ghost_element_selected: styles.colors.ghost_element_selected.map(serialize_color),
ghost_element_disabled: styles.colors.ghost_element_disabled.map(serialize_color),
text: styles.colors.text.map(serialize_color),
text_muted: styles.colors.text_muted.map(serialize_color),
text_placeholder: styles.colors.text_placeholder.map(serialize_color),
text_disabled: styles.colors.text_disabled.map(serialize_color),
text_accent: styles.colors.text_accent.map(serialize_color),
icon: styles.colors.icon.map(serialize_color),
icon_muted: styles.colors.icon_muted.map(serialize_color),
icon_disabled: styles.colors.icon_disabled.map(serialize_color),
icon_placeholder: styles.colors.icon_placeholder.map(serialize_color),
icon_accent: styles.colors.icon_accent.map(serialize_color),
status_bar_background: styles.colors.status_bar_background.map(serialize_color),
title_bar_background: styles.colors.title_bar_background.map(serialize_color),
toolbar_background: styles.colors.toolbar_background.map(serialize_color),
tab_bar_background: styles.colors.tab_bar_background.map(serialize_color),
tab_inactive_background: styles.colors.tab_inactive_background.map(serialize_color),
tab_active_background: styles.colors.tab_active_background.map(serialize_color),
search_match_background: styles.colors.search_match_background.map(serialize_color),
panel_background: styles.colors.panel_background.map(serialize_color),
panel_focused_border: styles.colors.panel_focused_border.map(serialize_color),
pane_focused_border: styles.colors.pane_focused_border.map(serialize_color),
scrollbar_thumb_background: styles
.colors
.scrollbar_thumb_background
.map(serialize_color),
scrollbar_thumb_hover_background: styles
.colors
.scrollbar_thumb_hover_background
.map(serialize_color),
scrollbar_thumb_border: styles.colors.scrollbar_thumb_border.map(serialize_color),
scrollbar_track_background: styles
.colors
.scrollbar_track_background
.map(serialize_color),
scrollbar_track_border: styles.colors.scrollbar_track_border.map(serialize_color),
editor_foreground: styles.colors.editor_foreground.map(serialize_color),
editor_background: styles.colors.editor_background.map(serialize_color),
editor_gutter_background: styles.colors.editor_gutter_background.map(serialize_color),
editor_subheader_background: styles
.colors
.editor_subheader_background
.map(serialize_color),
editor_active_line_background: styles
.colors
.editor_active_line_background
.map(serialize_color),
editor_highlighted_line_background: styles
.colors
.editor_highlighted_line_background
.map(serialize_color),
editor_line_number: styles.colors.editor_line_number.map(serialize_color),
editor_active_line_number: styles.colors.editor_active_line_number.map(serialize_color),
editor_invisible: styles.colors.editor_invisible.map(serialize_color),
editor_wrap_guide: styles.colors.editor_wrap_guide.map(serialize_color),
editor_active_wrap_guide: styles.colors.editor_active_wrap_guide.map(serialize_color),
editor_document_highlight_read_background: styles
.colors
.editor_document_highlight_read_background
.map(serialize_color),
editor_document_highlight_write_background: styles
.colors
.editor_document_highlight_write_background
.map(serialize_color),
terminal_background: styles.colors.terminal_background.map(serialize_color),
terminal_foreground: styles.colors.terminal_foreground.map(serialize_color),
terminal_bright_foreground: styles
.colors
.terminal_bright_foreground
.map(serialize_color),
terminal_dim_foreground: styles.colors.terminal_dim_foreground.map(serialize_color),
terminal_ansi_black: styles.colors.terminal_ansi_black.map(serialize_color),
terminal_ansi_bright_black: styles
.colors
.terminal_ansi_bright_black
.map(serialize_color),
terminal_ansi_dim_black: styles.colors.terminal_ansi_dim_black.map(serialize_color),
terminal_ansi_red: styles.colors.terminal_ansi_red.map(serialize_color),
terminal_ansi_bright_red: styles.colors.terminal_ansi_bright_red.map(serialize_color),
terminal_ansi_dim_red: styles.colors.terminal_ansi_dim_red.map(serialize_color),
terminal_ansi_green: styles.colors.terminal_ansi_green.map(serialize_color),
terminal_ansi_bright_green: styles
.colors
.terminal_ansi_bright_green
.map(serialize_color),
terminal_ansi_dim_green: styles.colors.terminal_ansi_dim_green.map(serialize_color),
terminal_ansi_yellow: styles.colors.terminal_ansi_yellow.map(serialize_color),
terminal_ansi_bright_yellow: styles
.colors
.terminal_ansi_bright_yellow
.map(serialize_color),
terminal_ansi_dim_yellow: styles.colors.terminal_ansi_dim_yellow.map(serialize_color),
terminal_ansi_blue: styles.colors.terminal_ansi_blue.map(serialize_color),
terminal_ansi_bright_blue: styles.colors.terminal_ansi_bright_blue.map(serialize_color),
terminal_ansi_dim_blue: styles.colors.terminal_ansi_dim_blue.map(serialize_color),
terminal_ansi_magenta: styles.colors.terminal_ansi_magenta.map(serialize_color),
terminal_ansi_bright_magenta: styles
.colors
.terminal_ansi_bright_magenta
.map(serialize_color),
terminal_ansi_dim_magenta: styles.colors.terminal_ansi_dim_magenta.map(serialize_color),
terminal_ansi_cyan: styles.colors.terminal_ansi_cyan.map(serialize_color),
terminal_ansi_bright_cyan: styles.colors.terminal_ansi_bright_cyan.map(serialize_color),
terminal_ansi_dim_cyan: styles.colors.terminal_ansi_dim_cyan.map(serialize_color),
terminal_ansi_white: styles.colors.terminal_ansi_white.map(serialize_color),
terminal_ansi_bright_white: styles
.colors
.terminal_ansi_bright_white
.map(serialize_color),
terminal_ansi_dim_white: styles.colors.terminal_ansi_dim_white.map(serialize_color),
link_text_hover: styles.colors.link_text_hover.map(serialize_color),
},
status: StatusColorsContent {
conflict: styles.status.conflict.map(serialize_color),
conflict_background: styles.status.conflict_background.map(serialize_color),
conflict_border: styles.status.conflict_border.map(serialize_color),
created: styles.status.created.map(serialize_color),
created_background: styles.status.created_background.map(serialize_color),
created_border: styles.status.created_border.map(serialize_color),
deleted: styles.status.deleted.map(serialize_color),
deleted_background: styles.status.deleted_background.map(serialize_color),
deleted_border: styles.status.deleted_border.map(serialize_color),
error: styles.status.error.map(serialize_color),
error_background: styles.status.error_background.map(serialize_color),
error_border: styles.status.error_border.map(serialize_color),
hidden: styles.status.hidden.map(serialize_color),
hidden_background: styles.status.hidden_background.map(serialize_color),
hidden_border: styles.status.hidden_border.map(serialize_color),
hint: styles.status.hint.map(serialize_color),
hint_background: styles.status.hint_background.map(serialize_color),
hint_border: styles.status.hint_border.map(serialize_color),
ignored: styles.status.ignored.map(serialize_color),
ignored_background: styles.status.ignored_background.map(serialize_color),
ignored_border: styles.status.ignored_border.map(serialize_color),
info: styles.status.info.map(serialize_color),
info_background: styles.status.info_background.map(serialize_color),
info_border: styles.status.info_border.map(serialize_color),
modified: styles.status.modified.map(serialize_color),
modified_background: styles.status.modified_background.map(serialize_color),
modified_border: styles.status.modified_border.map(serialize_color),
predictive: styles.status.predictive.map(serialize_color),
predictive_background: styles.status.predictive_background.map(serialize_color),
predictive_border: styles.status.predictive_border.map(serialize_color),
renamed: styles.status.renamed.map(serialize_color),
renamed_background: styles.status.renamed_background.map(serialize_color),
renamed_border: styles.status.renamed_border.map(serialize_color),
success: styles.status.success.map(serialize_color),
success_background: styles.status.success_background.map(serialize_color),
success_border: styles.status.success_border.map(serialize_color),
unreachable: styles.status.unreachable.map(serialize_color),
unreachable_background: styles.status.unreachable_background.map(serialize_color),
unreachable_border: styles.status.unreachable_border.map(serialize_color),
warning: styles.status.warning.map(serialize_color),
warning_background: styles.status.warning_background.map(serialize_color),
warning_border: styles.status.warning_border.map(serialize_color),
},
players: styles
.player
.map(|players| {
players
.0
.into_iter()
.map(|player_color| PlayerColorContent {
cursor: Some(player_color.cursor).map(serialize_color),
background: Some(player_color.background).map(serialize_color),
selection: Some(player_color.selection).map(serialize_color),
})
.collect()
})
.unwrap_or_default(),
syntax: styles
.syntax
.map(|syntax| {
IndexMap::from_iter(syntax.highlights.into_iter().map(|(name, style)| {
(
name,
HighlightStyleContent {
color: style.color.map(serialize_color),
font_style: style.font_style.map(|font_style| match font_style {
theme::UserFontStyle::Normal => theme::FontStyleContent::Normal,
theme::UserFontStyle::Italic => theme::FontStyleContent::Italic,
theme::UserFontStyle::Oblique => theme::FontStyleContent::Oblique,
}),
font_weight: style.font_weight.map(|font_weight| match font_weight.0 {
_ if font_weight.0 == 100.0 => FontWeightContent::Thin,
_ if font_weight.0 == 200.0 => FontWeightContent::ExtraLight,
_ if font_weight.0 == 300.0 => FontWeightContent::Light,
_ if font_weight.0 == 400.0 => FontWeightContent::Normal,
_ if font_weight.0 == 500.0 => FontWeightContent::Medium,
_ if font_weight.0 == 600.0 => FontWeightContent::Semibold,
_ if font_weight.0 == 700.0 => FontWeightContent::Bold,
_ if font_weight.0 == 800.0 => FontWeightContent::ExtraBold,
_ if font_weight.0 == 900.0 => FontWeightContent::Black,
_ => unreachable!(),
}),
},
)
}))
})
.unwrap_or_default(),
}
}

View File

@ -1,478 +0,0 @@
use std::fmt::{self, Debug};
use gpui::Hsla;
use theme::{
Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, SystemColors,
ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily,
UserThemeStylesRefinement,
};
use crate::color::pack_color;
struct RawSyntaxPrinter<'a>(&'a str);
impl<'a> Debug for RawSyntaxPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
struct HslaPrinter(Hsla);
impl Debug for HslaPrinter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "rgba({:#010x}).into()", pack_color(self.0))
}
}
struct IntoPrinter<'a, D: Debug>(&'a D);
impl<'a, D: Debug> Debug for IntoPrinter<'a, D> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}.into()", self.0)
}
}
pub struct OptionPrinter<'a, T>(&'a Option<T>);
impl<'a, T: Debug> Debug for OptionPrinter<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
Some(value) => write!(f, "Some({:?})", value),
None => write!(f, "None"),
}
}
}
pub struct VecPrinter<'a, T>(&'a Vec<T>);
impl<'a, T: Debug> Debug for VecPrinter<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "vec!{:?}", &self.0)
}
}
pub struct UserThemeFamilyPrinter(UserThemeFamily);
impl UserThemeFamilyPrinter {
pub fn new(theme_family: UserThemeFamily) -> Self {
Self(theme_family)
}
}
impl Debug for UserThemeFamilyPrinter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UserThemeFamily")
.field("name", &IntoPrinter(&self.0.name))
.field("author", &IntoPrinter(&self.0.author))
.field(
"themes",
&VecPrinter(
&self
.0
.themes
.iter()
.map(|theme| UserThemePrinter(theme))
.collect(),
),
)
.finish()
}
}
pub struct UserThemePrinter<'a>(&'a UserTheme);
impl<'a> Debug for UserThemePrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UserTheme")
.field("name", &IntoPrinter(&self.0.name))
.field("appearance", &AppearancePrinter(self.0.appearance))
.field("styles", &UserThemeStylesRefinementPrinter(&self.0.styles))
.finish()
}
}
pub struct AppearancePrinter(Appearance);
impl Debug for AppearancePrinter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Appearance::{:?}", self.0)
}
}
pub struct UserThemeStylesRefinementPrinter<'a>(&'a UserThemeStylesRefinement);
impl<'a> Debug for UserThemeStylesRefinementPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UserThemeStylesRefinement")
.field("colors", &ThemeColorsRefinementPrinter(&self.0.colors))
.field("status", &StatusColorsRefinementPrinter(&self.0.status))
.field(
"player",
&OptionPrinter(
&self
.0
.player
.as_ref()
.map(|player_colors| PlayerColorsPrinter(player_colors)),
),
)
.field(
"syntax",
&OptionPrinter(
&self
.0
.syntax
.as_ref()
.map(|syntax| UserSyntaxThemePrinter(syntax)),
),
)
.finish()
}
}
pub struct SystemColorsPrinter<'a>(&'a SystemColors);
impl<'a> Debug for SystemColorsPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SystemColors")
.field("transparent", &HslaPrinter(self.0.transparent))
.field(
"mac_os_traffic_light_red",
&HslaPrinter(self.0.mac_os_traffic_light_red),
)
.field(
"mac_os_traffic_light_yellow",
&HslaPrinter(self.0.mac_os_traffic_light_yellow),
)
.field(
"mac_os_traffic_light_green",
&HslaPrinter(self.0.mac_os_traffic_light_green),
)
.finish()
}
}
pub struct ThemeColorsRefinementPrinter<'a>(&'a ThemeColorsRefinement);
impl<'a> Debug for ThemeColorsRefinementPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let theme_colors = vec![
("border", self.0.border),
("border_variant", self.0.border_variant),
("border_focused", self.0.border_focused),
("border_selected", self.0.border_selected),
("border_transparent", self.0.border_transparent),
("border_disabled", self.0.border_disabled),
(
"elevated_surface_background",
self.0.elevated_surface_background,
),
("surface_background", self.0.surface_background),
("background", self.0.background),
("panel_background", self.0.panel_background),
("element_background", self.0.element_background),
("element_hover", self.0.element_hover),
("element_active", self.0.element_active),
("element_selected", self.0.element_selected),
("element_disabled", self.0.element_disabled),
("drop_target_background", self.0.drop_target_background),
("ghost_element_background", self.0.ghost_element_background),
("ghost_element_hover", self.0.ghost_element_hover),
("ghost_element_active", self.0.ghost_element_active),
("ghost_element_selected", self.0.ghost_element_selected),
("ghost_element_disabled", self.0.ghost_element_disabled),
("text", self.0.text),
("text_muted", self.0.text_muted),
("text_placeholder", self.0.text_placeholder),
("text_disabled", self.0.text_disabled),
("text_accent", self.0.text_accent),
("icon", self.0.icon),
("icon_muted", self.0.icon_muted),
("icon_disabled", self.0.icon_disabled),
("icon_placeholder", self.0.icon_placeholder),
("icon_accent", self.0.icon_accent),
("status_bar_background", self.0.status_bar_background),
("title_bar_background", self.0.title_bar_background),
("toolbar_background", self.0.toolbar_background),
("tab_bar_background", self.0.tab_bar_background),
("tab_inactive_background", self.0.tab_inactive_background),
("tab_active_background", self.0.tab_active_background),
(
"scrollbar_thumb_background",
self.0.scrollbar_thumb_background,
),
(
"scrollbar_thumb_hover_background",
self.0.scrollbar_thumb_hover_background,
),
("scrollbar_thumb_border", self.0.scrollbar_thumb_border),
(
"scrollbar_track_background",
self.0.scrollbar_track_background,
),
("scrollbar_track_border", self.0.scrollbar_track_border),
("editor_foreground", self.0.editor_foreground),
("editor_background", self.0.editor_background),
("editor_gutter_background", self.0.editor_gutter_background),
(
"editor_subheader_background",
self.0.editor_subheader_background,
),
(
"editor_active_line_background",
self.0.editor_active_line_background,
),
(
"editor_highlighted_line_background",
self.0.editor_highlighted_line_background,
),
("editor_line_number", self.0.editor_line_number),
(
"editor_active_line_number",
self.0.editor_active_line_number,
),
("editor_invisible", self.0.editor_invisible),
("editor_wrap_guide", self.0.editor_wrap_guide),
("editor_active_wrap_guide", self.0.editor_active_wrap_guide),
(
"editor_document_highlight_read_background",
self.0.editor_document_highlight_read_background,
),
(
"editor_document_highlight_write_background",
self.0.editor_document_highlight_write_background,
),
("terminal_background", self.0.terminal_background),
("terminal_foreground", self.0.terminal_foreground),
(
"terminal_bright_foreground",
self.0.terminal_bright_foreground,
),
("terminal_dim_foreground", self.0.terminal_dim_foreground),
("terminal_ansi_black", self.0.terminal_ansi_black),
(
"terminal_ansi_bright_black",
self.0.terminal_ansi_bright_black,
),
("terminal_ansi_dim_black", self.0.terminal_ansi_dim_black),
("terminal_ansi_red", self.0.terminal_ansi_red),
("terminal_ansi_bright_red", self.0.terminal_ansi_bright_red),
("terminal_ansi_dim_red", self.0.terminal_ansi_dim_red),
("terminal_ansi_green", self.0.terminal_ansi_green),
(
"terminal_ansi_bright_green",
self.0.terminal_ansi_bright_green,
),
("terminal_ansi_dim_green", self.0.terminal_ansi_dim_green),
("terminal_ansi_yellow", self.0.terminal_ansi_yellow),
(
"terminal_ansi_bright_yellow",
self.0.terminal_ansi_bright_yellow,
),
("terminal_ansi_dim_yellow", self.0.terminal_ansi_dim_yellow),
("terminal_ansi_blue", self.0.terminal_ansi_blue),
(
"terminal_ansi_bright_blue",
self.0.terminal_ansi_bright_blue,
),
("terminal_ansi_dim_blue", self.0.terminal_ansi_dim_blue),
("terminal_ansi_magenta", self.0.terminal_ansi_magenta),
(
"terminal_ansi_bright_magenta",
self.0.terminal_ansi_bright_magenta,
),
(
"terminal_ansi_dim_magenta",
self.0.terminal_ansi_dim_magenta,
),
("terminal_ansi_cyan", self.0.terminal_ansi_cyan),
(
"terminal_ansi_bright_cyan",
self.0.terminal_ansi_bright_cyan,
),
("terminal_ansi_dim_cyan", self.0.terminal_ansi_dim_cyan),
("terminal_ansi_white", self.0.terminal_ansi_white),
(
"terminal_ansi_bright_white",
self.0.terminal_ansi_bright_white,
),
("terminal_ansi_dim_white", self.0.terminal_ansi_dim_white),
("link_text_hover", self.0.link_text_hover),
];
f.write_str("ThemeColorsRefinement {")?;
for (color_name, color) in theme_colors {
if let Some(color) = color {
f.write_str(color_name)?;
f.write_str(": ")?;
f.write_str("Some(")?;
HslaPrinter(color).fmt(f)?;
f.write_str(")")?;
f.write_str(",")?;
} else {
log::warn!(target: "theme_printer", "No value for '{}' in theme", color_name);
}
}
f.write_str("..Default::default()")?;
f.write_str("}")
}
}
pub struct StatusColorsRefinementPrinter<'a>(&'a StatusColorsRefinement);
impl<'a> Debug for StatusColorsRefinementPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let status_colors = vec![
("conflict", self.0.conflict),
("conflict_background", self.0.conflict_background),
("conflict_border", self.0.conflict_border),
("created", self.0.created),
("created_background", self.0.created_background),
("created_border", self.0.created_border),
("deleted", self.0.deleted),
("deleted_background", self.0.deleted_background),
("deleted_border", self.0.deleted_border),
("error", self.0.error),
("error_background", self.0.error_background),
("error_border", self.0.error_border),
("hidden", self.0.hidden),
("hidden_background", self.0.hidden_background),
("hidden_border", self.0.hidden_border),
("hint", self.0.hint),
("hint_background", self.0.hint_background),
("hint_border", self.0.hint_border),
("ignored", self.0.ignored),
("ignored_background", self.0.ignored_background),
("ignored_border", self.0.ignored_border),
("info", self.0.info),
("info_background", self.0.info_background),
("info_border", self.0.info_border),
("modified", self.0.modified),
("modified_background", self.0.modified_background),
("modified_border", self.0.modified_border),
("predictive", self.0.predictive),
("predictive_background", self.0.predictive_background),
("predictive_border", self.0.predictive_border),
("renamed", self.0.renamed),
("renamed_background", self.0.renamed_background),
("renamed_border", self.0.renamed_border),
("success", self.0.success),
("success_background", self.0.success_background),
("success_border", self.0.success_border),
("unreachable", self.0.unreachable),
("unreachable_background", self.0.unreachable_background),
("unreachable_border", self.0.unreachable_border),
("warning", self.0.warning),
("warning_background", self.0.warning_background),
("warning_border", self.0.warning_border),
];
f.write_str("StatusColorsRefinement {")?;
for (color_name, color) in status_colors {
if let Some(color) = color {
f.write_str(color_name)?;
f.write_str(": ")?;
f.write_str("Some(")?;
HslaPrinter(color).fmt(f)?;
f.write_str(")")?;
f.write_str(",")?;
}
}
f.write_str("..Default::default()")?;
f.write_str("}")
}
}
pub struct PlayerColorsPrinter<'a>(&'a PlayerColors);
impl<'a> Debug for PlayerColorsPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("PlayerColors")
.field(&VecPrinter(
&self
.0
.0
.iter()
.map(|player_color| PlayerColorPrinter(player_color))
.collect(),
))
.finish()
}
}
pub struct PlayerColorPrinter<'a>(&'a PlayerColor);
impl<'a> Debug for PlayerColorPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("PlayerColor")
.field("cursor", &HslaPrinter(self.0.cursor))
.field("background", &HslaPrinter(self.0.background))
.field("selection", &HslaPrinter(self.0.selection))
.finish()
}
}
pub struct UserSyntaxThemePrinter<'a>(&'a UserSyntaxTheme);
impl<'a> Debug for UserSyntaxThemePrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("UserSyntaxTheme")
.field(
"highlights",
&VecPrinter(
&self
.0
.highlights
.iter()
.map(|(token, highlight)| {
(IntoPrinter(token), UserHighlightStylePrinter(&highlight))
})
.collect(),
),
)
.finish()
}
}
pub struct UserHighlightStylePrinter<'a>(&'a UserHighlightStyle);
impl<'a> Debug for UserHighlightStylePrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("UserHighlightStyle {")?;
if let Some(color) = self.0.color {
f.write_str("color")?;
f.write_str(": ")?;
f.write_str("Some(")?;
HslaPrinter(color).fmt(f)?;
f.write_str(")")?;
f.write_str(",")?;
}
if let Some(font_style) = self.0.font_style {
f.write_str("font_style")?;
f.write_str(": ")?;
f.write_str("Some(")?;
write!(f, "UserFontStyle::{:?}", font_style)?;
f.write_str(")")?;
f.write_str(",")?;
}
if let Some(font_weight) = self.0.font_weight.as_ref() {
f.write_str("font_weight")?;
f.write_str(": ")?;
f.write_str("Some(")?;
write!(f, "UserFontWeight({:?})", font_weight.0)?;
f.write_str(")")?;
f.write_str(",")?;
}
f.write_str("..Default::default()")?;
f.write_str("}")
}
}

View File

@ -1,30 +1,27 @@
use anyhow::Result;
use gpui::rgba;
use indexmap::IndexMap;
use strum::IntoEnumIterator;
use theme::{
StatusColorsRefinement, ThemeColorsRefinement, UserFontStyle, UserFontWeight,
UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement,
FontStyleContent, FontWeightContent, HighlightStyleContent, StatusColorsContent,
ThemeColorsContent, ThemeContent, ThemeStyleContent,
};
use crate::color::try_parse_color;
use crate::util::Traverse;
use crate::vscode::{VsCodeTheme, VsCodeTokenScope};
use crate::ThemeMetadata;
use super::ZedSyntaxToken;
pub(crate) fn try_parse_font_weight(font_style: &str) -> Option<UserFontWeight> {
pub(crate) fn try_parse_font_weight(font_style: &str) -> Option<FontWeightContent> {
match font_style {
style if style.contains("bold") => Some(UserFontWeight::BOLD),
style if style.contains("bold") => Some(FontWeightContent::Bold),
_ => None,
}
}
pub(crate) fn try_parse_font_style(font_style: &str) -> Option<UserFontStyle> {
pub(crate) fn try_parse_font_style(font_style: &str) -> Option<FontStyleContent> {
match font_style {
style if style.contains("italic") => Some(UserFontStyle::Italic),
style if style.contains("oblique") => Some(UserFontStyle::Oblique),
style if style.contains("italic") => Some(FontStyleContent::Italic),
style if style.contains("oblique") => Some(FontStyleContent::Oblique),
_ => None,
}
}
@ -48,292 +45,145 @@ impl VsCodeThemeConverter {
}
}
pub fn convert(self) -> Result<UserTheme> {
pub fn convert(self) -> Result<ThemeContent> {
let appearance = self.theme_metadata.appearance.into();
let status_color_refinements = self.convert_status_colors()?;
let theme_colors_refinements = self.convert_theme_colors()?;
let status_colors = self.convert_status_colors()?;
let theme_colors = self.convert_theme_colors()?;
let syntax_theme = self.convert_syntax_theme()?;
Ok(UserTheme {
Ok(ThemeContent {
name: self.theme_metadata.name,
appearance,
styles: UserThemeStylesRefinement {
colors: theme_colors_refinements,
status: status_color_refinements,
player: None,
syntax: Some(syntax_theme),
style: ThemeStyleContent {
colors: theme_colors,
status: status_colors,
players: Vec::new(),
syntax: syntax_theme,
},
})
}
fn convert_status_colors(&self) -> Result<StatusColorsRefinement> {
fn convert_status_colors(&self) -> Result<StatusColorsContent> {
let vscode_colors = &self.theme.colors;
let vscode_base_status_colors = StatusColorsRefinement {
hint: Some(rgba(0x969696ff).into()),
let vscode_base_status_colors = StatusColorsContent {
hint: Some("#969696ff".to_string()),
..Default::default()
};
Ok(StatusColorsRefinement {
created: vscode_colors
.editor_gutter_added_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
modified: vscode_colors
.editor_gutter_modified_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
deleted: vscode_colors
.editor_gutter_deleted_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
Ok(StatusColorsContent {
created: vscode_colors.editor_gutter_added_background.clone(),
modified: vscode_colors.editor_gutter_modified_background.clone(),
deleted: vscode_colors.editor_gutter_deleted_background.clone(),
conflict: vscode_colors
.git_decoration_conflicting_resource_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
error: vscode_colors
.error_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
hidden: vscode_colors
.tab_inactive_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
.clone(),
error: vscode_colors.error_foreground.clone(),
hidden: vscode_colors.tab_inactive_foreground.clone(),
hint: vscode_colors
.editor_inlay_hint_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.clone()
.or(vscode_base_status_colors.hint),
ignored: vscode_colors
.git_decoration_ignored_resource_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
.clone(),
// info: None,
// renamed: None,
// success: None,
warning: vscode_colors
.list_warning_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
warning: vscode_colors.list_warning_foreground.clone(),
..Default::default()
})
}
fn convert_theme_colors(&self) -> Result<ThemeColorsRefinement> {
fn convert_theme_colors(&self) -> Result<ThemeColorsContent> {
let vscode_colors = &self.theme.colors;
let vscode_panel_border = vscode_colors
.panel_border
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_tab_inactive_background = vscode_colors
.tab_inactive_background
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_editor_foreground = vscode_colors
.editor_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_editor_background = vscode_colors
.editor_background
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_scrollbar_slider_background = vscode_colors
.scrollbar_slider_background
.as_ref()
.traverse(|color| try_parse_color(&color))?;
let vscode_panel_border = vscode_colors.panel_border.clone();
let vscode_tab_inactive_background = vscode_colors.tab_inactive_background.clone();
let vscode_editor_foreground = vscode_colors.editor_foreground.clone();
let vscode_editor_background = vscode_colors.editor_background.clone();
let vscode_scrollbar_slider_background = vscode_colors.scrollbar_slider_background.clone();
let vscode_token_colors_foreground = self
.theme
.token_colors
.iter()
.find(|token_color| token_color.scope.is_none())
.and_then(|token_color| token_color.settings.foreground.as_ref())
.traverse(|color| try_parse_color(&color))
.ok()
.flatten();
.cloned();
Ok(ThemeColorsRefinement {
border: vscode_panel_border,
border_variant: vscode_panel_border,
border_focused: vscode_colors
.focus_border
.as_ref()
.traverse(|color| try_parse_color(&color))?,
border_disabled: vscode_panel_border,
border_selected: vscode_panel_border,
border_transparent: vscode_panel_border,
elevated_surface_background: vscode_colors
.dropdown_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
surface_background: vscode_colors
.panel_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
background: vscode_editor_background,
title_bar_background: vscode_colors
.title_bar_active_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
status_bar_background: vscode_colors
.status_bar_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
element_background: vscode_colors
.button_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
element_hover: vscode_colors
.list_hover_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
element_selected: vscode_colors
.list_active_selection_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
ghost_element_hover: vscode_colors
.list_hover_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
ghost_element_selected: vscode_colors
.list_active_selection_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
drop_target_background: vscode_colors
.list_drop_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
Ok(ThemeColorsContent {
border: vscode_panel_border.clone(),
border_variant: vscode_panel_border.clone(),
border_focused: vscode_colors.focus_border.clone(),
border_disabled: vscode_panel_border.clone(),
border_selected: vscode_panel_border.clone(),
border_transparent: vscode_panel_border.clone(),
elevated_surface_background: vscode_colors.dropdown_background.clone(),
surface_background: vscode_colors.panel_background.clone(),
background: vscode_editor_background.clone(),
title_bar_background: vscode_colors.title_bar_active_background.clone(),
status_bar_background: vscode_colors.status_bar_background.clone(),
element_background: vscode_colors.button_background.clone(),
element_hover: vscode_colors.list_hover_background.clone(),
element_selected: vscode_colors.list_active_selection_background.clone(),
ghost_element_hover: vscode_colors.list_hover_background.clone(),
ghost_element_selected: vscode_colors.list_active_selection_background.clone(),
drop_target_background: vscode_colors.list_drop_background.clone(),
text: vscode_colors
.foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_token_colors_foreground),
text_muted: vscode_colors
.tab_inactive_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
link_text_hover: vscode_colors
.text_link_active_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
tab_bar_background: vscode_colors
.editor_group_header_tabs_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
.clone()
.or(vscode_token_colors_foreground.clone()),
text_muted: vscode_colors.tab_inactive_foreground.clone(),
link_text_hover: vscode_colors.text_link_active_foreground.clone(),
tab_bar_background: vscode_colors.editor_group_header_tabs_background.clone(),
tab_active_background: vscode_colors
.tab_active_background
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_tab_inactive_background),
tab_inactive_background: vscode_tab_inactive_background,
.clone()
.or(vscode_tab_inactive_background.clone()),
tab_inactive_background: vscode_tab_inactive_background.clone(),
toolbar_background: vscode_colors
.breadcrumb_background
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_editor_background),
editor_foreground: vscode_editor_foreground.or(vscode_token_colors_foreground),
editor_background: vscode_editor_background,
editor_gutter_background: vscode_editor_background,
editor_line_number: vscode_colors
.editor_line_number_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
editor_active_line_number: vscode_colors
.editor_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
editor_wrap_guide: vscode_panel_border,
editor_active_wrap_guide: vscode_panel_border,
scrollbar_track_background: vscode_editor_background,
scrollbar_track_border: vscode_colors
.editor_overview_ruler_border
.as_ref()
.traverse(|color| try_parse_color(&color))?,
scrollbar_thumb_background: vscode_scrollbar_slider_background,
scrollbar_thumb_border: vscode_scrollbar_slider_background,
.clone()
.or(vscode_editor_background.clone()),
editor_foreground: vscode_editor_foreground
.clone()
.or(vscode_token_colors_foreground.clone()),
editor_background: vscode_editor_background.clone(),
editor_gutter_background: vscode_editor_background.clone(),
editor_line_number: vscode_colors.editor_line_number_foreground.clone(),
editor_active_line_number: vscode_colors.editor_foreground.clone(),
editor_wrap_guide: vscode_panel_border.clone(),
editor_active_wrap_guide: vscode_panel_border.clone(),
scrollbar_track_background: vscode_editor_background.clone(),
scrollbar_track_border: vscode_colors.editor_overview_ruler_border.clone(),
scrollbar_thumb_background: vscode_scrollbar_slider_background.clone(),
scrollbar_thumb_border: vscode_scrollbar_slider_background.clone(),
scrollbar_thumb_hover_background: vscode_colors
.scrollbar_slider_hover_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_background: vscode_colors
.terminal_background
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_black: vscode_colors
.terminal_ansi_bright_black
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_red: vscode_colors
.terminal_ansi_bright_red
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_green: vscode_colors
.terminal_ansi_bright_green
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_yellow: vscode_colors
.terminal_ansi_bright_yellow
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_blue: vscode_colors
.terminal_ansi_bright_blue
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_magenta: vscode_colors
.terminal_ansi_bright_magenta
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_cyan: vscode_colors
.terminal_ansi_bright_cyan
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_bright_white: vscode_colors
.terminal_ansi_bright_white
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_black: vscode_colors
.terminal_ansi_black
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_red: vscode_colors
.terminal_ansi_red
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_green: vscode_colors
.terminal_ansi_green
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_yellow: vscode_colors
.terminal_ansi_yellow
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_blue: vscode_colors
.terminal_ansi_blue
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_magenta: vscode_colors
.terminal_ansi_magenta
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_cyan: vscode_colors
.terminal_ansi_cyan
.as_ref()
.traverse(|color| try_parse_color(&color))?,
terminal_ansi_white: vscode_colors
.terminal_ansi_white
.as_ref()
.traverse(|color| try_parse_color(&color))?,
.clone(),
terminal_background: vscode_colors.terminal_background.clone(),
terminal_ansi_bright_black: vscode_colors.terminal_ansi_bright_black.clone(),
terminal_ansi_bright_red: vscode_colors.terminal_ansi_bright_red.clone(),
terminal_ansi_bright_green: vscode_colors.terminal_ansi_bright_green.clone(),
terminal_ansi_bright_yellow: vscode_colors.terminal_ansi_bright_yellow.clone(),
terminal_ansi_bright_blue: vscode_colors.terminal_ansi_bright_blue.clone(),
terminal_ansi_bright_magenta: vscode_colors.terminal_ansi_bright_magenta.clone(),
terminal_ansi_bright_cyan: vscode_colors.terminal_ansi_bright_cyan.clone(),
terminal_ansi_bright_white: vscode_colors.terminal_ansi_bright_white.clone(),
terminal_ansi_black: vscode_colors.terminal_ansi_black.clone(),
terminal_ansi_red: vscode_colors.terminal_ansi_red.clone(),
terminal_ansi_green: vscode_colors.terminal_ansi_green.clone(),
terminal_ansi_yellow: vscode_colors.terminal_ansi_yellow.clone(),
terminal_ansi_blue: vscode_colors.terminal_ansi_blue.clone(),
terminal_ansi_magenta: vscode_colors.terminal_ansi_magenta.clone(),
terminal_ansi_cyan: vscode_colors.terminal_ansi_cyan.clone(),
terminal_ansi_white: vscode_colors.terminal_ansi_white.clone(),
..Default::default()
})
}
fn convert_syntax_theme(&self) -> Result<UserSyntaxTheme> {
fn convert_syntax_theme(&self) -> Result<IndexMap<String, HighlightStyleContent>> {
let mut highlight_styles = IndexMap::new();
for syntax_token in ZedSyntaxToken::iter() {
@ -371,12 +221,8 @@ impl VsCodeThemeConverter {
.unwrap_or_else(|| "no identifier".to_string())
);
let highlight_style = UserHighlightStyle {
color: token_color
.settings
.foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
let highlight_style = HighlightStyleContent {
color: token_color.settings.foreground.clone(),
font_style: token_color
.settings
.font_style
@ -396,8 +242,6 @@ impl VsCodeThemeConverter {
highlight_styles.insert(syntax_token.to_string(), highlight_style);
}
Ok(UserSyntaxTheme {
highlights: highlight_styles.into_iter().collect(),
})
Ok(highlight_styles)
}
}

View File

@ -1,6 +0,0 @@
mod converter;
mod licenses;
pub mod theme;
pub use converter::*;
pub use licenses::*;

View File

@ -1,302 +0,0 @@
use anyhow::{Context, Result};
use gpui::{Hsla, Rgba};
use theme::{
color_alpha, Appearance, PlayerColor, PlayerColors, StatusColorsRefinement,
ThemeColorsRefinement, UserFontStyle, UserFontWeight, UserHighlightStyle, UserSyntaxTheme,
UserTheme, UserThemeStylesRefinement,
};
use crate::zed1::theme::{
Color as Zed1Color, ColorScheme, HighlightStyle as Zed1HighlightStyle, Theme as Zed1Theme,
Weight,
};
fn zed1_color_to_hsla(color: Zed1Color) -> Hsla {
let r = color.r as f32 / 255.;
let g = color.g as f32 / 255.;
let b = color.b as f32 / 255.;
let a = color.a as f32 / 255.;
Hsla::from(Rgba { r, g, b, a })
}
fn zed1_highlight_style_to_user_highlight_style(
highlight: Zed1HighlightStyle,
) -> UserHighlightStyle {
UserHighlightStyle {
color: highlight.color.map(zed1_color_to_hsla),
font_style: highlight.italic.map(|is_italic| {
if is_italic {
UserFontStyle::Italic
} else {
UserFontStyle::Normal
}
}),
font_weight: highlight.weight.map(|weight| match weight {
Weight::thin => UserFontWeight::THIN,
Weight::extra_light => UserFontWeight::EXTRA_LIGHT,
Weight::light => UserFontWeight::LIGHT,
Weight::normal => UserFontWeight::NORMAL,
Weight::medium => UserFontWeight::MEDIUM,
Weight::semibold => UserFontWeight::SEMIBOLD,
Weight::bold => UserFontWeight::BOLD,
Weight::extra_bold => UserFontWeight::EXTRA_BOLD,
Weight::black => UserFontWeight::BLACK,
}),
}
}
pub struct Zed1ThemeConverter {
theme: Zed1Theme,
}
impl Zed1ThemeConverter {
pub fn new(theme: Zed1Theme) -> Self {
Self { theme }
}
pub fn convert(self) -> Result<UserTheme> {
let appearance = match self.theme.meta.is_light {
true => Appearance::Light,
false => Appearance::Dark,
};
let status_colors_refinement = self.convert_status_colors()?;
let theme_colors_refinement = self.convert_theme_colors()?;
let player_colors = self.convert_player_colors()?;
let syntax_theme = self.convert_syntax_theme()?;
Ok(UserTheme {
name: self.theme.meta.name,
appearance,
styles: UserThemeStylesRefinement {
colors: theme_colors_refinement,
status: status_colors_refinement,
player: Some(player_colors),
syntax: Some(syntax_theme),
},
})
}
fn convert_status_colors(&self) -> Result<StatusColorsRefinement> {
fn convert(color: Zed1Color) -> Option<Hsla> {
Some(zed1_color_to_hsla(color))
}
let base_theme: ColorScheme = serde_json::from_value(self.theme.base_theme.clone())
.with_context(|| "failed to parse `theme.base_theme`")?;
let lowest = &base_theme.lowest;
let editor = &self.theme.editor;
Ok(StatusColorsRefinement {
created: convert(lowest.positive.default.foreground),
created_background: convert(lowest.positive.default.background),
created_border: convert(lowest.positive.default.border),
modified: convert(lowest.warning.default.foreground),
modified_background: convert(lowest.warning.default.background),
modified_border: convert(lowest.warning.default.border),
deleted: convert(lowest.negative.default.foreground),
deleted_background: convert(lowest.negative.default.background),
deleted_border: convert(lowest.negative.default.border),
success: convert(lowest.positive.default.foreground),
success_background: convert(lowest.positive.default.background),
success_border: convert(lowest.positive.default.border),
warning: convert(lowest.warning.default.foreground),
warning_background: convert(lowest.warning.default.background),
warning_border: convert(lowest.warning.default.border),
error: convert(lowest.negative.default.foreground),
error_background: convert(lowest.negative.default.background),
error_border: convert(lowest.negative.default.border),
// The `hint` color used in Zed1 is inlined from the syntax colors.
hint: editor
.hint
.color
.map(zed1_color_to_hsla)
.or(convert(lowest.accent.default.foreground)),
hint_background: convert(lowest.accent.default.background),
hint_border: convert(lowest.accent.default.border),
predictive: editor
.suggestion
.color
.map(zed1_color_to_hsla)
.or(convert(lowest.positive.default.foreground)),
predictive_background: convert(lowest.positive.default.background),
predictive_border: convert(lowest.positive.default.border),
conflict: convert(lowest.warning.default.foreground),
conflict_background: convert(lowest.warning.default.background),
conflict_border: convert(lowest.warning.default.border),
hidden: convert(lowest.base.disabled.foreground),
hidden_background: convert(lowest.base.disabled.background),
hidden_border: convert(lowest.base.disabled.border),
ignored: convert(lowest.variant.default.foreground),
ignored_background: convert(lowest.variant.default.background),
ignored_border: convert(lowest.variant.default.border),
info: convert(lowest.accent.default.foreground),
info_background: convert(lowest.accent.default.background),
info_border: convert(lowest.accent.default.border),
renamed: convert(lowest.accent.default.foreground),
renamed_background: convert(lowest.accent.default.background),
renamed_border: convert(lowest.accent.default.border),
unreachable: convert(lowest.variant.default.foreground), // TODO: Should this be transparent?
unreachable_background: convert(lowest.variant.default.background),
unreachable_border: convert(lowest.variant.default.border),
})
}
fn convert_player_colors(&self) -> Result<PlayerColors> {
let player_one = self.theme.editor.selection;
let mut player_colors = vec![PlayerColor {
cursor: zed1_color_to_hsla(player_one.cursor),
selection: zed1_color_to_hsla(player_one.selection),
background: zed1_color_to_hsla(player_one.cursor),
}];
for index in 1..8 {
let player = self
.theme
.editor
.selection_style_for_room_participant(index);
player_colors.push(PlayerColor {
cursor: zed1_color_to_hsla(player.cursor),
selection: zed1_color_to_hsla(player.selection),
background: zed1_color_to_hsla(player.cursor),
});
}
Ok(PlayerColors(player_colors))
}
fn convert_theme_colors(&self) -> Result<ThemeColorsRefinement> {
fn convert(color: Zed1Color) -> Option<Hsla> {
Some(zed1_color_to_hsla(color))
}
let base_theme: ColorScheme = serde_json::from_value(self.theme.base_theme.clone())
.with_context(|| "failed to parse `theme.base_theme`")?;
let lowest = &base_theme.lowest;
let middle = &base_theme.middle;
let highest = &base_theme.highest;
let editor = &self.theme.editor;
let terminal = &self.theme.terminal;
Ok(ThemeColorsRefinement {
border: convert(lowest.base.default.border),
border_variant: convert(middle.variant.default.border),
border_focused: convert(lowest.accent.hovered.border),
border_selected: convert(lowest.accent.default.border),
border_transparent: Some(gpui::transparent_black()),
border_disabled: convert(lowest.base.disabled.border),
elevated_surface_background: convert(middle.base.default.background),
surface_background: convert(middle.base.default.background),
background: convert(lowest.base.default.background),
element_background: convert(lowest.on.default.background),
element_hover: convert(lowest.on.hovered.background),
element_active: convert(lowest.on.active.background),
element_selected: convert(lowest.on.active.background), // TODO: Check what this should be
element_disabled: convert(lowest.on.disabled.background),
drop_target_background: convert(self.theme.workspace.drop_target_overlay_color),
ghost_element_background: Some(gpui::transparent_black()),
ghost_element_hover: convert(lowest.on.hovered.background),
ghost_element_active: convert(lowest.on.active.background),
ghost_element_selected: convert(lowest.on.active.background), // TODO: Check what this should be
ghost_element_disabled: convert(lowest.on.disabled.background),
text: convert(lowest.base.default.foreground),
text_muted: convert(lowest.variant.default.foreground),
text_placeholder: convert(lowest.base.disabled.foreground), // TODO: What should placeholder be?
text_disabled: convert(lowest.base.disabled.foreground),
text_accent: convert(lowest.accent.default.foreground),
icon: convert(lowest.base.default.foreground),
icon_muted: convert(lowest.variant.default.foreground),
icon_disabled: convert(lowest.base.disabled.foreground),
icon_placeholder: convert(lowest.variant.default.foreground),
icon_accent: convert(lowest.accent.default.foreground),
status_bar_background: convert(lowest.base.default.background),
title_bar_background: convert(lowest.base.default.background),
toolbar_background: convert(highest.base.default.background),
tab_bar_background: convert(middle.base.default.background),
tab_inactive_background: convert(middle.base.default.background),
tab_active_background: convert(highest.base.default.background),
search_match_background: convert(highest.accent.default.background),
panel_background: convert(middle.base.default.background),
panel_focused_border: convert(lowest.accent.hovered.border),
pane_focused_border: convert(lowest.accent.hovered.border),
scrollbar_thumb_background: convert(middle.base.inverted.background)
.map(|color| color_alpha(color, 0.3)),
scrollbar_thumb_hover_background: convert(middle.base.hovered.background),
scrollbar_thumb_border: convert(middle.base.default.border),
scrollbar_track_background: Some(gpui::transparent_black()),
scrollbar_track_border: convert(highest.variant.default.border),
editor_foreground: convert(editor.text_color),
editor_background: convert(editor.background),
editor_gutter_background: convert(editor.gutter_background),
editor_subheader_background: convert(middle.base.default.background),
editor_active_line_background: convert(editor.active_line_background),
editor_highlighted_line_background: convert(editor.highlighted_line_background),
editor_line_number: convert(editor.line_number),
editor_active_line_number: convert(editor.line_number_active),
editor_invisible: convert(editor.whitespace),
editor_wrap_guide: convert(editor.wrap_guide),
editor_active_wrap_guide: convert(editor.active_wrap_guide),
editor_document_highlight_read_background: convert(
editor.document_highlight_read_background,
),
editor_document_highlight_write_background: convert(
editor.document_highlight_write_background,
),
terminal_background: convert(terminal.background),
terminal_foreground: convert(terminal.foreground),
terminal_bright_foreground: convert(terminal.bright_foreground),
terminal_dim_foreground: convert(terminal.dim_foreground),
terminal_ansi_black: convert(terminal.black),
terminal_ansi_bright_black: convert(terminal.bright_black),
terminal_ansi_dim_black: convert(terminal.dim_black),
terminal_ansi_red: convert(terminal.red),
terminal_ansi_bright_red: convert(terminal.bright_red),
terminal_ansi_dim_red: convert(terminal.dim_red),
terminal_ansi_green: convert(terminal.green),
terminal_ansi_bright_green: convert(terminal.bright_green),
terminal_ansi_dim_green: convert(terminal.dim_green),
terminal_ansi_yellow: convert(terminal.yellow),
terminal_ansi_bright_yellow: convert(terminal.bright_yellow),
terminal_ansi_dim_yellow: convert(terminal.dim_yellow),
terminal_ansi_blue: convert(terminal.blue),
terminal_ansi_bright_blue: convert(terminal.bright_blue),
terminal_ansi_dim_blue: convert(terminal.dim_blue),
terminal_ansi_magenta: convert(terminal.magenta),
terminal_ansi_bright_magenta: convert(terminal.bright_magenta),
terminal_ansi_dim_magenta: convert(terminal.dim_magenta),
terminal_ansi_cyan: convert(terminal.cyan),
terminal_ansi_bright_cyan: convert(terminal.bright_cyan),
terminal_ansi_dim_cyan: convert(terminal.dim_cyan),
terminal_ansi_white: convert(terminal.white),
terminal_ansi_bright_white: convert(terminal.bright_white),
terminal_ansi_dim_white: convert(terminal.dim_white),
link_text_hover: convert(highest.accent.default.foreground),
})
}
fn convert_syntax_theme(&self) -> Result<UserSyntaxTheme> {
Ok(UserSyntaxTheme {
highlights: self
.theme
.editor
.syntax
.highlights
.clone()
.into_iter()
.map(|(name, highlight_style)| {
(
name,
zed1_highlight_style_to_user_highlight_style(highlight_style),
)
})
.collect(),
})
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff