Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Emit all themes at once

Marshall Bowers3591ffe4a799
diff --git a/Cargo.lock b/Cargo.lock
index 5e158405b7b..dc5684e115d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8740,6 +8740,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"clap 4.4.4",
+ "convert_case 0.6.0",
"gpui2",
"log",
"rust-embed",
diff --git a/crates/theme2/src/themes/one_dark.rs b/crates/theme2/src/themes/one_dark.rs
index c59f4da16ad..d9be9043d6e 100644
--- a/crates/theme2/src/themes/one_dark.rs
+++ b/crates/theme2/src/themes/one_dark.rs
@@ -1,131 +1,85 @@
-use gpui2::rgba;
-
-use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
-
-pub fn one_dark() -> Theme {
- Theme {
- metadata: ThemeMetadata {
- name: "One Dark".into(),
- is_light: false,
+Theme {
+ metadata: ThemeMetadata {
+ name: "One Dark".into(),
+ is_light: false,
+ },
+ transparent: rgba(0x00000000).into(),
+ mac_os_traffic_light_red: rgba(0xec695eff).into(),
+ mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
+ mac_os_traffic_light_green: rgba(0x61c553ff).into(),
+ border: rgba(0x464b57ff).into(),
+ border_variant: rgba(0x464b57ff).into(),
+ border_focused: rgba(0x293b5bff).into(),
+ border_transparent: rgba(0x00000000).into(),
+ elevated_surface: rgba(0x3b414dff).into(),
+ surface: rgba(0x2f343eff).into(),
+ background: rgba(0x3b414dff).into(),
+ filled_element: rgba(0x3b414dff).into(),
+ filled_element_hover: rgba(0xffffff1e).into(),
+ filled_element_active: rgba(0xffffff28).into(),
+ filled_element_selected: rgba(0x18243dff).into(),
+ filled_element_disabled: rgba(0x00000000).into(),
+ ghost_element: rgba(0x00000000).into(),
+ ghost_element_hover: rgba(0xffffff14).into(),
+ ghost_element_active: rgba(0xffffff1e).into(),
+ ghost_element_selected: rgba(0x18243dff).into(),
+ ghost_element_disabled: rgba(0x00000000).into(),
+ text: rgba(0xc8ccd4ff).into(),
+ text_muted: rgba(0x838994ff).into(),
+ text_placeholder: rgba(0xd07277ff).into(),
+ text_disabled: rgba(0x555a63ff).into(),
+ text_accent: rgba(0x74ade8ff).into(),
+ icon_muted: rgba(0x838994ff).into(),
+ syntax: SyntaxTheme {
+ highlights: vec![("punctuation".into(), rgba(0xacb2beff).into()), ("comment".into(), rgba(0x5d636fff).into()), ("predictive".into(), rgba(0x5a6a87ff).into()), ("comment.doc".into(), rgba(0x878e98ff).into()), ("punctuation.bracket".into(), rgba(0xb2b9c6ff).into()), ("constant".into(), rgba(0xdfc184ff).into()), ("text.literal".into(), rgba(0xa1c181ff).into()), ("attribute".into(), rgba(0x74ade8ff).into()), ("link_text".into(), rgba(0x73ade9ff).into()), ("primary".into(), rgba(0xacb2beff).into()), ("enum".into(), rgba(0xd07277ff).into()), ("emphasis.strong".into(), rgba(0xbf956aff).into()), ("property".into(), rgba(0xd07277ff).into()), ("emphasis".into(), rgba(0x74ade8ff).into()), ("string.regex".into(), rgba(0xbf956aff).into()), ("variable".into(), rgba(0xc8ccd4ff).into()), ("keyword".into(), rgba(0xb477cfff).into()), ("boolean".into(), rgba(0xbf956aff).into()), ("variable.special".into(), rgba(0xbf956aff).into()), ("punctuation.special".into(), rgba(0xb1574bff).into()), ("title".into(), rgba(0xd07277ff).into()), ("punctuation.list_marker".into(), rgba(0xd07277ff).into()), ("string.special".into(), rgba(0xbf956aff).into()), ("number".into(), rgba(0xbf956aff).into()), ("preproc".into(), rgba(0xc8ccd4ff).into()), ("constructor".into(), rgba(0x73ade9ff).into()), ("string.special.symbol".into(), rgba(0xbf956aff).into()), ("link_uri".into(), rgba(0x6eb4bfff).into()), ("string".into(), rgba(0xa1c181ff).into()), ("string.escape".into(), rgba(0x878e98ff).into()), ("operator".into(), rgba(0x6eb4bfff).into()), ("hint".into(), rgba(0x5a6f89ff).into()), ("label".into(), rgba(0x74ade8ff).into()), ("type".into(), rgba(0x6eb4bfff).into()), ("embedded".into(), rgba(0xc8ccd4ff).into()), ("function".into(), rgba(0x73ade9ff).into()), ("tag".into(), rgba(0x74ade8ff).into()), ("variant".into(), rgba(0x73ade9ff).into()), ("punctuation.delimiter".into(), rgba(0xb2b9c6ff).into())],
+ },
+ status_bar: rgba(0x3b414dff).into(),
+ title_bar: rgba(0x3b414dff).into(),
+ toolbar: rgba(0x282c33ff).into(),
+ tab_bar: rgba(0x2f343eff).into(),
+ editor: rgba(0x282c33ff).into(),
+ editor_subheader: rgba(0x2f343eff).into(),
+ editor_active_line: rgba(0x2f343eff).into(),
+ terminal: rgba(0x282c33ff).into(),
+ image_fallback_background: rgba(0x3b414dff).into(),
+ git_created: rgba(0xa1c181ff).into(),
+ git_modified: rgba(0x74ade8ff).into(),
+ git_deleted: rgba(0xd07277ff).into(),
+ git_conflict: rgba(0xdec184ff).into(),
+ git_ignored: rgba(0x555a63ff).into(),
+ git_renamed: rgba(0xdec184ff).into(),
+ players: [
+ PlayerTheme {
+ cursor: rgba(0x74ade8ff).into(),
+ selection: rgba(0x74ade83d).into(),
},
- transparent: rgba(0x00000000).into(),
- mac_os_traffic_light_red: rgba(0xec695eff).into(),
- mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
- mac_os_traffic_light_green: rgba(0x61c553ff).into(),
- border: rgba(0x464b57ff).into(),
- border_variant: rgba(0x464b57ff).into(),
- border_focused: rgba(0x293b5bff).into(),
- border_transparent: rgba(0x00000000).into(),
- elevated_surface: rgba(0x3b414dff).into(),
- surface: rgba(0x2f343eff).into(),
- background: rgba(0x3b414dff).into(),
- filled_element: rgba(0x3b414dff).into(),
- filled_element_hover: rgba(0xffffff1e).into(),
- filled_element_active: rgba(0xffffff28).into(),
- filled_element_selected: rgba(0x18243dff).into(),
- filled_element_disabled: rgba(0x00000000).into(),
- ghost_element: rgba(0x00000000).into(),
- ghost_element_hover: rgba(0xffffff14).into(),
- ghost_element_active: rgba(0xffffff1e).into(),
- ghost_element_selected: rgba(0x18243dff).into(),
- ghost_element_disabled: rgba(0x00000000).into(),
- text: rgba(0xc8ccd4ff).into(),
- text_muted: rgba(0x838994ff).into(),
- text_placeholder: rgba(0xd07277ff).into(),
- text_disabled: rgba(0x555a63ff).into(),
- text_accent: rgba(0x74ade8ff).into(),
- icon_muted: rgba(0x838994ff).into(),
- syntax: SyntaxTheme {
- highlights: vec![
- ("link_uri".into(), rgba(0x6eb4bfff).into()),
- ("number".into(), rgba(0xbf956aff).into()),
- ("property".into(), rgba(0xd07277ff).into()),
- ("boolean".into(), rgba(0xbf956aff).into()),
- ("label".into(), rgba(0x74ade8ff).into()),
- ("punctuation.list_marker".into(), rgba(0xd07277ff).into()),
- ("keyword".into(), rgba(0xb477cfff).into()),
- ("punctuation.delimiter".into(), rgba(0xb2b9c6ff).into()),
- ("string.special".into(), rgba(0xbf956aff).into()),
- ("constant".into(), rgba(0xdfc184ff).into()),
- ("punctuation".into(), rgba(0xacb2beff).into()),
- ("variable.special".into(), rgba(0xbf956aff).into()),
- ("preproc".into(), rgba(0xc8ccd4ff).into()),
- ("enum".into(), rgba(0xd07277ff).into()),
- ("attribute".into(), rgba(0x74ade8ff).into()),
- ("emphasis.strong".into(), rgba(0xbf956aff).into()),
- ("title".into(), rgba(0xd07277ff).into()),
- ("hint".into(), rgba(0x5a6f89ff).into()),
- ("emphasis".into(), rgba(0x74ade8ff).into()),
- ("string.regex".into(), rgba(0xbf956aff).into()),
- ("link_text".into(), rgba(0x73ade9ff).into()),
- ("string".into(), rgba(0xa1c181ff).into()),
- ("comment.doc".into(), rgba(0x878e98ff).into()),
- ("punctuation.special".into(), rgba(0xb1574bff).into()),
- ("primary".into(), rgba(0xacb2beff).into()),
- ("operator".into(), rgba(0x6eb4bfff).into()),
- ("function".into(), rgba(0x73ade9ff).into()),
- ("string.special.symbol".into(), rgba(0xbf956aff).into()),
- ("type".into(), rgba(0x6eb4bfff).into()),
- ("variant".into(), rgba(0x73ade9ff).into()),
- ("tag".into(), rgba(0x74ade8ff).into()),
- ("punctuation.bracket".into(), rgba(0xb2b9c6ff).into()),
- ("embedded".into(), rgba(0xc8ccd4ff).into()),
- ("string.escape".into(), rgba(0x878e98ff).into()),
- ("variable".into(), rgba(0xc8ccd4ff).into()),
- ("predictive".into(), rgba(0x5a6a87ff).into()),
- ("comment".into(), rgba(0x5d636fff).into()),
- ("text.literal".into(), rgba(0xa1c181ff).into()),
- ("constructor".into(), rgba(0x73ade9ff).into()),
- ],
+ PlayerTheme {
+ cursor: rgba(0xa1c181ff).into(),
+ selection: rgba(0xa1c1813d).into(),
},
- status_bar: rgba(0x3b414dff).into(),
- title_bar: rgba(0x3b414dff).into(),
- toolbar: rgba(0x282c33ff).into(),
- tab_bar: rgba(0x2f343eff).into(),
- editor: rgba(0x282c33ff).into(),
- editor_subheader: rgba(0x2f343eff).into(),
- editor_active_line: rgba(0x2f343eff).into(),
- terminal: rgba(0x282c33ff).into(),
- image_fallback_background: rgba(0x3b414dff).into(),
- git_created: rgba(0xa1c181ff).into(),
- git_modified: rgba(0x74ade8ff).into(),
- git_deleted: rgba(0xd07277ff).into(),
- git_conflict: rgba(0xdec184ff).into(),
- git_ignored: rgba(0x555a63ff).into(),
- git_renamed: rgba(0xdec184ff).into(),
- players: [
- PlayerTheme {
- cursor: rgba(0x74ade8ff).into(),
- selection: rgba(0x74ade83d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xa1c181ff).into(),
- selection: rgba(0xa1c1813d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xbe5046ff).into(),
- selection: rgba(0xbe50463d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xbf956aff).into(),
- selection: rgba(0xbf956a3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xb477cfff).into(),
- selection: rgba(0xb477cf3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0x6eb4bfff).into(),
- selection: rgba(0x6eb4bf3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xd07277ff).into(),
- selection: rgba(0xd072773d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xdec184ff).into(),
- selection: rgba(0xdec1843d).into(),
- },
- ],
- }
-}
+ PlayerTheme {
+ cursor: rgba(0xbe5046ff).into(),
+ selection: rgba(0xbe50463d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xbf956aff).into(),
+ selection: rgba(0xbf956a3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xb477cfff).into(),
+ selection: rgba(0xb477cf3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0x6eb4bfff).into(),
+ selection: rgba(0x6eb4bf3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xd07277ff).into(),
+ selection: rgba(0xd072773d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xdec184ff).into(),
+ selection: rgba(0xdec1843d).into(),
+ },
+ ],
+}
\ No newline at end of file
diff --git a/crates/theme2/src/themes/sandcastle.rs b/crates/theme2/src/themes/sandcastle.rs
index 4e87c427f06..507c99209f5 100644
--- a/crates/theme2/src/themes/sandcastle.rs
+++ b/crates/theme2/src/themes/sandcastle.rs
@@ -1,130 +1,85 @@
-use gpui2::rgba;
-
-use crate::{PlayerTheme, SyntaxTheme, Theme, ThemeMetadata};
-
-pub fn sandcastle() -> Theme {
- Theme {
- metadata: ThemeMetadata {
- name: "Sandcastle".into(),
- is_light: false,
+Theme {
+ metadata: ThemeMetadata {
+ name: "Sandcastle".into(),
+ is_light: false,
+ },
+ transparent: rgba(0x00000000).into(),
+ mac_os_traffic_light_red: rgba(0xec695eff).into(),
+ mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
+ mac_os_traffic_light_green: rgba(0x61c553ff).into(),
+ border: rgba(0x3d4350ff).into(),
+ border_variant: rgba(0x3d4350ff).into(),
+ border_focused: rgba(0x223131ff).into(),
+ border_transparent: rgba(0x00000000).into(),
+ elevated_surface: rgba(0x333944ff).into(),
+ surface: rgba(0x2b3038ff).into(),
+ background: rgba(0x333944ff).into(),
+ filled_element: rgba(0x333944ff).into(),
+ filled_element_hover: rgba(0xffffff1e).into(),
+ filled_element_active: rgba(0xffffff28).into(),
+ filled_element_selected: rgba(0x171e1eff).into(),
+ filled_element_disabled: rgba(0x00000000).into(),
+ ghost_element: rgba(0x00000000).into(),
+ ghost_element_hover: rgba(0xffffff14).into(),
+ ghost_element_active: rgba(0xffffff1e).into(),
+ ghost_element_selected: rgba(0x171e1eff).into(),
+ ghost_element_disabled: rgba(0x00000000).into(),
+ text: rgba(0xfdf4c1ff).into(),
+ text_muted: rgba(0xa69782ff).into(),
+ text_placeholder: rgba(0xb3627aff).into(),
+ text_disabled: rgba(0x827568ff).into(),
+ text_accent: rgba(0x518b8bff).into(),
+ icon_muted: rgba(0xa69782ff).into(),
+ syntax: SyntaxTheme {
+ highlights: vec![("variable".into(), rgba(0xfdf4c1ff).into()), ("comment.doc".into(), rgba(0xa89984ff).into()), ("punctuation".into(), rgba(0xd5c5a1ff).into()), ("comment".into(), rgba(0xa89984ff).into()), ("punctuation.special".into(), rgba(0xd5c5a1ff).into()), ("string.regex".into(), rgba(0xa07d3aff).into()), ("emphasis".into(), rgba(0x518b8bff).into()), ("link_uri".into(), rgba(0x83a598ff).into()), ("label".into(), rgba(0x518b8bff).into()), ("property".into(), rgba(0x518b8bff).into()), ("constant".into(), rgba(0x83a598ff).into()), ("enum".into(), rgba(0xa07d3aff).into()), ("number".into(), rgba(0x83a598ff).into()), ("link_text".into(), rgba(0xa07d3aff).into()), ("hint".into(), rgba(0x727d68ff).into()), ("type".into(), rgba(0x83a598ff).into()), ("title".into(), rgba(0xfdf4c1ff).into()), ("punctuation.delimiter".into(), rgba(0xd5c5a1ff).into()), ("function".into(), rgba(0xa07d3aff).into()), ("preproc".into(), rgba(0xfdf4c1ff).into()), ("boolean".into(), rgba(0x83a598ff).into()), ("keyword".into(), rgba(0x518b8bff).into()), ("attribute".into(), rgba(0x518b8bff).into()), ("predictive".into(), rgba(0x5c6152ff).into()), ("string".into(), rgba(0xa07d3aff).into()), ("emphasis.strong".into(), rgba(0x518b8bff).into()), ("punctuation.bracket".into(), rgba(0xd5c5a1ff).into()), ("string.special.symbol".into(), rgba(0xa07d3aff).into()), ("variant".into(), rgba(0x518b8bff).into()), ("tag".into(), rgba(0x518b8bff).into()), ("primary".into(), rgba(0xfdf4c1ff).into()), ("string.special".into(), rgba(0xa07d3aff).into()), ("punctuation.list_marker".into(), rgba(0xd5c5a1ff).into()), ("string.escape".into(), rgba(0xa89984ff).into()), ("constructor".into(), rgba(0x518b8bff).into()), ("embedded".into(), rgba(0xfdf4c1ff).into()), ("operator".into(), rgba(0xa07d3aff).into()), ("text.literal".into(), rgba(0xa07d3aff).into())],
+ },
+ status_bar: rgba(0x333944ff).into(),
+ title_bar: rgba(0x333944ff).into(),
+ toolbar: rgba(0x282c33ff).into(),
+ tab_bar: rgba(0x2b3038ff).into(),
+ editor: rgba(0x282c33ff).into(),
+ editor_subheader: rgba(0x2b3038ff).into(),
+ editor_active_line: rgba(0x2b3038ff).into(),
+ terminal: rgba(0x282c33ff).into(),
+ image_fallback_background: rgba(0x333944ff).into(),
+ git_created: rgba(0x83a598ff).into(),
+ git_modified: rgba(0x518b8bff).into(),
+ git_deleted: rgba(0xb3627aff).into(),
+ git_conflict: rgba(0xa07d3aff).into(),
+ git_ignored: rgba(0x827568ff).into(),
+ git_renamed: rgba(0xa07d3aff).into(),
+ players: [
+ PlayerTheme {
+ cursor: rgba(0x518b8bff).into(),
+ selection: rgba(0x518b8b3d).into(),
},
- transparent: rgba(0x00000000).into(),
- mac_os_traffic_light_red: rgba(0xec695eff).into(),
- mac_os_traffic_light_yellow: rgba(0xf4bf4eff).into(),
- mac_os_traffic_light_green: rgba(0x61c553ff).into(),
- border: rgba(0x3d4350ff).into(),
- border_variant: rgba(0x3d4350ff).into(),
- border_focused: rgba(0x223131ff).into(),
- border_transparent: rgba(0x00000000).into(),
- elevated_surface: rgba(0x333944ff).into(),
- surface: rgba(0x2b3038ff).into(),
- background: rgba(0x333944ff).into(),
- filled_element: rgba(0x333944ff).into(),
- filled_element_hover: rgba(0xffffff1e).into(),
- filled_element_active: rgba(0xffffff28).into(),
- filled_element_selected: rgba(0x171e1eff).into(),
- filled_element_disabled: rgba(0x00000000).into(),
- ghost_element: rgba(0x00000000).into(),
- ghost_element_hover: rgba(0xffffff14).into(),
- ghost_element_active: rgba(0xffffff1e).into(),
- ghost_element_selected: rgba(0x171e1eff).into(),
- ghost_element_disabled: rgba(0x00000000).into(),
- text: rgba(0xfdf4c1ff).into(),
- text_muted: rgba(0xa69782ff).into(),
- text_placeholder: rgba(0xb3627aff).into(),
- text_disabled: rgba(0x827568ff).into(),
- text_accent: rgba(0x518b8bff).into(),
- icon_muted: rgba(0xa69782ff).into(),
- syntax: SyntaxTheme {
- highlights: vec![
- ("string.special.symbol".into(), rgba(0xa07d3aff).into()),
- ("enum".into(), rgba(0xa07d3aff).into()),
- ("punctuation.bracket".into(), rgba(0xd5c5a1ff).into()),
- ("hint".into(), rgba(0x727d68ff).into()),
- ("punctuation.delimiter".into(), rgba(0xd5c5a1ff).into()),
- ("comment".into(), rgba(0xa89984ff).into()),
- ("embedded".into(), rgba(0xfdf4c1ff).into()),
- ("string".into(), rgba(0xa07d3aff).into()),
- ("string.escape".into(), rgba(0xa89984ff).into()),
- ("comment.doc".into(), rgba(0xa89984ff).into()),
- ("variant".into(), rgba(0x518b8bff).into()),
- ("predictive".into(), rgba(0x5c6152ff).into()),
- ("link_text".into(), rgba(0xa07d3aff).into()),
- ("attribute".into(), rgba(0x518b8bff).into()),
- ("title".into(), rgba(0xfdf4c1ff).into()),
- ("emphasis.strong".into(), rgba(0x518b8bff).into()),
- ("primary".into(), rgba(0xfdf4c1ff).into()),
- ("punctuation.list_marker".into(), rgba(0xd5c5a1ff).into()),
- ("boolean".into(), rgba(0x83a598ff).into()),
- ("function".into(), rgba(0xa07d3aff).into()),
- ("punctuation.special".into(), rgba(0xd5c5a1ff).into()),
- ("string.special".into(), rgba(0xa07d3aff).into()),
- ("string.regex".into(), rgba(0xa07d3aff).into()),
- ("tag".into(), rgba(0x518b8bff).into()),
- ("keyword".into(), rgba(0x518b8bff).into()),
- ("type".into(), rgba(0x83a598ff).into()),
- ("text.literal".into(), rgba(0xa07d3aff).into()),
- ("link_uri".into(), rgba(0x83a598ff).into()),
- ("label".into(), rgba(0x518b8bff).into()),
- ("property".into(), rgba(0x518b8bff).into()),
- ("number".into(), rgba(0x83a598ff).into()),
- ("constructor".into(), rgba(0x518b8bff).into()),
- ("preproc".into(), rgba(0xfdf4c1ff).into()),
- ("emphasis".into(), rgba(0x518b8bff).into()),
- ("variable".into(), rgba(0xfdf4c1ff).into()),
- ("operator".into(), rgba(0xa07d3aff).into()),
- ("punctuation".into(), rgba(0xd5c5a1ff).into()),
- ("constant".into(), rgba(0x83a598ff).into()),
- ],
+ PlayerTheme {
+ cursor: rgba(0x83a598ff).into(),
+ selection: rgba(0x83a5983d).into(),
},
- status_bar: rgba(0x333944ff).into(),
- title_bar: rgba(0x333944ff).into(),
- toolbar: rgba(0x282c33ff).into(),
- tab_bar: rgba(0x2b3038ff).into(),
- editor: rgba(0x282c33ff).into(),
- editor_subheader: rgba(0x2b3038ff).into(),
- editor_active_line: rgba(0x2b3038ff).into(),
- terminal: rgba(0x282c33ff).into(),
- image_fallback_background: rgba(0x333944ff).into(),
- git_created: rgba(0x83a598ff).into(),
- git_modified: rgba(0x518b8bff).into(),
- git_deleted: rgba(0xb3627aff).into(),
- git_conflict: rgba(0xa07d3aff).into(),
- git_ignored: rgba(0x827568ff).into(),
- git_renamed: rgba(0xa07d3aff).into(),
- players: [
- PlayerTheme {
- cursor: rgba(0x518b8bff).into(),
- selection: rgba(0x518b8b3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0x83a598ff).into(),
- selection: rgba(0x83a5983d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xa87222ff).into(),
- selection: rgba(0xa872223d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xa07d3aff).into(),
- selection: rgba(0xa07d3a3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xd75f5fff).into(),
- selection: rgba(0xd75f5f3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0x83a598ff).into(),
- selection: rgba(0x83a5983d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xb3627aff).into(),
- selection: rgba(0xb3627a3d).into(),
- },
- PlayerTheme {
- cursor: rgba(0xa07d3aff).into(),
- selection: rgba(0xa07d3a3d).into(),
- },
- ],
- }
-}
+ PlayerTheme {
+ cursor: rgba(0xa87222ff).into(),
+ selection: rgba(0xa872223d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xa07d3aff).into(),
+ selection: rgba(0xa07d3a3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xd75f5fff).into(),
+ selection: rgba(0xd75f5f3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0x83a598ff).into(),
+ selection: rgba(0x83a5983d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xb3627aff).into(),
+ selection: rgba(0xb3627a3d).into(),
+ },
+ PlayerTheme {
+ cursor: rgba(0xa07d3aff).into(),
+ selection: rgba(0xa07d3a3d).into(),
+ },
+ ],
+}
\ No newline at end of file
diff --git a/crates/theme_converter/Cargo.toml b/crates/theme_converter/Cargo.toml
index 2a36dfce676..0ec692b7cc8 100644
--- a/crates/theme_converter/Cargo.toml
+++ b/crates/theme_converter/Cargo.toml
@@ -9,6 +9,7 @@ publish = false
[dependencies]
anyhow.workspace = true
clap = { version = "4.4", features = ["derive", "string"] }
+convert_case = "0.6.0"
gpui2 = { path = "../gpui2" }
log.workspace = true
rust-embed.workspace = true
diff --git a/crates/theme_converter/src/main.rs b/crates/theme_converter/src/main.rs
index ec31296c1d8..3c2ab4ee90c 100644
--- a/crates/theme_converter/src/main.rs
+++ b/crates/theme_converter/src/main.rs
@@ -3,9 +3,14 @@ mod theme_printer;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt::{self, Debug};
+use std::fs::{self, File};
+use std::io::Write;
+use std::path::PathBuf;
+use std::str::FromStr;
use anyhow::{anyhow, Context, Result};
use clap::Parser;
+use convert_case::{Case, Casing};
use gpui2::{hsla, rgb, serde_json, AssetSource, Hsla, SharedString};
use log::LevelFilter;
use rust_embed::RustEmbed;
@@ -26,13 +31,31 @@ struct Args {
fn main() -> Result<()> {
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
- let args = Args::parse();
+ // let args = Args::parse();
- let (json_theme, legacy_theme) = load_theme(args.theme)?;
+ let themes_path = PathBuf::from_str("crates/theme2/src/themes")?;
- let theme = convert_theme(json_theme, legacy_theme)?;
+ for theme_path in Assets.list("themes/")? {
+ let (_, theme_name) = theme_path.split_once("themes/").unwrap();
- println!("{:#?}", ThemePrinter::new(theme));
+ if theme_name == ".gitkeep" {
+ continue;
+ }
+
+ let (json_theme, legacy_theme) = load_theme(&theme_path)?;
+
+ let theme = convert_theme(json_theme, legacy_theme)?;
+
+ let theme_slug = theme.metadata.name.as_ref().to_case(Case::Snake);
+
+ let mut output_file = File::create(themes_path.join(format!("{theme_slug}.rs")))?;
+
+ let theme_module = format!("{:#?}", ThemePrinter::new(theme));
+
+ output_file.write_all(theme_module.as_bytes())?;
+
+ // println!("{:#?}", ThemePrinter::new(theme));
+ }
Ok(())
}
@@ -188,9 +211,9 @@ struct JsonSyntaxStyle {
}
/// Loads the [`Theme`] with the given name.
-fn load_theme(name: String) -> Result<(JsonTheme, LegacyTheme)> {
- let theme_contents = Assets::get(&format!("themes/{name}.json"))
- .with_context(|| format!("theme file not found: '{name}'"))?;
+fn load_theme(theme_path: &str) -> Result<(JsonTheme, LegacyTheme)> {
+ let theme_contents =
+ Assets::get(theme_path).with_context(|| format!("theme file not found: '{theme_path}'"))?;
let json_theme: JsonTheme = serde_json::from_str(std::str::from_utf8(&theme_contents.data)?)
.context("failed to parse legacy theme")?;