diff --git a/Cargo.lock b/Cargo.lock index 52a4bae21f7d2676245a7d88b0986ea8bb00904d..ba76a5db4af8e07d7e0f6fdb4ea7b9bcd3da7bd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9134,6 +9134,7 @@ dependencies = [ "anyhow", "convert_case 0.6.0", "gpui2", + "indexmap 1.9.3", "log", "rust-embed", "serde", diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index e48f58a7a2b6e7f8e6aca3461e15fc73bedd6660..5d1afae99ce82407e1e2074274bdd045817e29f4 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -62,9 +62,9 @@ pub fn andromeda() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x95e072ff).into()), + color: Some(rgba(0x9fa0a6cc).into()), ..Default::default() }, ), @@ -76,9 +76,9 @@ pub fn andromeda() -> UserThemeFamily { }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x9fa0a6cc).into()), + color: Some(rgba(0x95e072ff).into()), ..Default::default() }, ), @@ -135,9 +135,9 @@ pub fn andromeda() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x95e072ff).into()), + color: Some(rgba(0x9fa0a6cc).into()), ..Default::default() }, ), @@ -149,9 +149,9 @@ pub fn andromeda() -> UserThemeFamily { }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x9fa0a6cc).into()), + color: Some(rgba(0x95e072ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index 0401ff46a255eed7ec1e086faa77c88a1be2cca9..632b060fea70d6c9ece5ce20ae4e49e07505d731 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -66,16 +66,16 @@ pub fn ayu() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0xfa8d3eff).into()), + color: Some(rgba(0x787b8099).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x787b8099).into()), + color: Some(rgba(0xfa8d3eff).into()), ..Default::default() }, ), @@ -143,7 +143,7 @@ pub fn ayu() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { color: Some(rgba(0xb8cfe680).into()), ..Default::default() @@ -157,7 +157,7 @@ pub fn ayu() -> UserThemeFamily { }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { color: Some(rgba(0xb8cfe680).into()), ..Default::default() @@ -227,16 +227,16 @@ pub fn ayu() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0xabb5be8c).into()), + color: Some(rgba(0xff8f3fff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xff8f3fff).into()), + color: Some(rgba(0xabb5be8c).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index 716ece161e9d0ad60c6460a2f7f767b35bae15c3..07342b6e6bb7888c06007638d6c7c96fc9f4fba3 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -74,16 +74,16 @@ pub fn dracula() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0xff79c6ff).into()), + color: Some(rgba(0xf8f8f2ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xf8f8f2ff).into()), + color: Some(rgba(0xff79c6ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index 1d4da9922edf0120f01a68f9170afb73852c1d97..542b0816bb4ba12f9d4712e5043bc3ba9f3ea261 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -72,14 +72,14 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { color: Some(rgba(0x83a598ff).into()), ..Default::default() @@ -141,21 +141,21 @@ pub fn gruvbox() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + color: Some(rgba(0x928374ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x928374ff).into()), + color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { color: Some(rgba(0x83a598ff).into()), ..Default::default() @@ -217,9 +217,9 @@ pub fn gruvbox() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x83a598ff).into()), + color: Some(rgba(0x928374ff).into()), ..Default::default() }, ), @@ -231,9 +231,9 @@ pub fn gruvbox() -> UserThemeFamily { }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x928374ff).into()), + color: Some(rgba(0x83a598ff).into()), ..Default::default() }, ), @@ -369,16 +369,16 @@ pub fn gruvbox() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x066578ff).into()), + color: Some(rgba(0x928374ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x928374ff).into()), + color: Some(rgba(0x066578ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/night_owl.rs b/crates/theme2/src/themes/night_owl.rs index 2d5b1bd26be88354a08a68219376d6ebe5145a73..37b835119efb84d24d3d54347a05026e6ce88f2a 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -66,23 +66,23 @@ pub fn night_owl() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0xd3413dff).into()), + color: Some(rgba(0x637777ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x637777ff).into()), + color: Some(rgba(0x7fcac3ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0xd3413dff).into()), ..Default::default() }, ), @@ -144,16 +144,16 @@ pub fn night_owl() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x0b969bff).into()), + color: Some(rgba(0x989fb1ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x989fb1ff).into()), + color: Some(rgba(0x0b969bff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index 1a6e942b1fc4548a599abc9c89ed03ba0f8cc37b..4069fb3063f4cb0797a24a1b3a8d8a435e3c2164 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -67,23 +67,23 @@ pub fn nord() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0xa3be8cff).into()), + color: Some(rgba(0x606e87ff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x606e87ff).into()), + color: Some(rgba(0x81a1c1ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x81a1c1ff).into()), + color: Some(rgba(0xa3be8cff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/notctis.rs b/crates/theme2/src/themes/notctis.rs index cab9f39530748793421386aa58a7d55ae805900e..ec4ca8527ee31b4d030bc3c8e748e1ea5ffae1ee 100644 --- a/crates/theme2/src/themes/notctis.rs +++ b/crates/theme2/src/themes/notctis.rs @@ -68,23 +68,23 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0x5888a5ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x49ace9ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x5888a5ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), @@ -154,16 +154,16 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x49ace9ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), @@ -226,23 +226,23 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x00b368ff).into()), + color: Some(rgba(0x8ca6a6ff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x8ca6a6ff).into()), + color: Some(rgba(0x0094f0ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x00b368ff).into()), ..Default::default() }, ), @@ -305,23 +305,23 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x00b368ff).into()), + color: Some(rgba(0x9995b7ff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x9995b7ff).into()), + color: Some(rgba(0x0094f0ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x00b368ff).into()), ..Default::default() }, ), @@ -384,16 +384,16 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x0094f0ff).into()), + color: Some(rgba(0x8ca6a6ff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x8ca6a6ff).into()), + color: Some(rgba(0x0094f0ff).into()), ..Default::default() }, ), @@ -463,23 +463,23 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x72c09fff).into()), + color: Some(rgba(0x5d7787ff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5d7787ff).into()), + color: Some(rgba(0x5897bfff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x5897bfff).into()), + color: Some(rgba(0x72c09fff).into()), ..Default::default() }, ), @@ -542,23 +542,23 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x5b858bff).into()), ..Default::default() }, ), ( - "comment".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x5b858bff).into()), + color: Some(rgba(0x49ace9ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), @@ -707,16 +707,16 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x49ace9ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), @@ -779,9 +779,9 @@ pub fn notctis() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x716b93ff).into()), ..Default::default() }, ), @@ -793,9 +793,9 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x716b93ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), @@ -865,16 +865,16 @@ pub fn notctis() -> UserThemeFamily { }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x49e9a6ff).into()), + color: Some(rgba(0x49ace9ff).into()), ..Default::default() }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x49ace9ff).into()), + color: Some(rgba(0x49e9a6ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 94e002478262a59a12ab3aef46a84b58d92f9858..a371f1f117ddceb673f1e9f3e02594fd45f72b0e 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -143,16 +143,16 @@ pub fn palenight() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "something".into(), + "comment".into(), UserHighlightStyle { - color: Some(rgba(0x7fcac3ff).into()), + color: Some(rgba(0x687097ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x687097ff).into()), + color: Some(rgba(0x7fcac3ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index 6d5f6b256ddd0e7bd871181ef5d4fd2f63ffdf75..9a029f4ba7e54b60a762dd8337beebd9807fa544 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -230,16 +230,16 @@ pub fn rose_pine() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x9893a5ff).into()), + color: Some(rgba(0xd7827dff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xd7827dff).into()), + color: Some(rgba(0x9893a5ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index 538beff8ba1c2ac4dd9db04d13dc36cd1b3d38ae..58a4e3d3cbb00d4426211dfd61837476d273473f 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -62,23 +62,23 @@ pub fn solarized() -> UserThemeFamily { syntax: Some(UserSyntaxTheme { highlights: vec![ ( - "punctuation".into(), + "comment".into(), UserHighlightStyle { color: Some(rgba(0x657b83ff).into()), ..Default::default() }, ), ( - "comment".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x657b83ff).into()), + color: Some(rgba(0x93a1a1ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x93a1a1ff).into()), + color: Some(rgba(0x657b83ff).into()), ..Default::default() }, ), @@ -139,16 +139,16 @@ pub fn solarized() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0x93a1a1ff).into()), + color: Some(rgba(0x657b83ff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0x657b83ff).into()), + color: Some(rgba(0x93a1a1ff).into()), ..Default::default() }, ), diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index eec0fe4e143cc581f720a760b12c8c50b61e2777..269828fd5bbb935360cc0795695a1a4db0dad109 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -59,16 +59,16 @@ pub fn synthwave_84() -> UserThemeFamily { }, ), ( - "punctuation".into(), + "something".into(), UserHighlightStyle { - color: Some(rgba(0xfede5cff).into()), + color: Some(rgba(0xfe444fff).into()), ..Default::default() }, ), ( - "something".into(), + "punctuation".into(), UserHighlightStyle { - color: Some(rgba(0xfe444fff).into()), + color: Some(rgba(0xfede5cff).into()), ..Default::default() }, ), diff --git a/crates/theme_importer/Cargo.toml b/crates/theme_importer/Cargo.toml index 1109a60977ace0bb5decae880d4761580411732c..28ae305735393bfb1cb3f8e3acd53a5c42a7246b 100644 --- a/crates/theme_importer/Cargo.toml +++ b/crates/theme_importer/Cargo.toml @@ -10,6 +10,7 @@ publish = false anyhow.workspace = true convert_case = "0.6.0" gpui = { package = "gpui2", path = "../gpui2" } +indexmap = "1.6.2" log.workspace = true rust-embed.workspace = true serde.workspace = true diff --git a/crates/theme_importer/src/vscode/converter.rs b/crates/theme_importer/src/vscode/converter.rs index b203807dbcc9fc441284e257876679ae02534ab3..d0fe5fb3d997fa497597cc9ce5b8717d420c40e2 100644 --- a/crates/theme_importer/src/vscode/converter.rs +++ b/crates/theme_importer/src/vscode/converter.rs @@ -1,7 +1,6 @@ -use std::collections::HashMap; - use anyhow::Result; use gpui::{Hsla, Rgba}; +use indexmap::IndexMap; use theme::{ StatusColorsRefinement, ThemeColorsRefinement, UserSyntaxTheme, UserTheme, UserThemeStylesRefinement, @@ -34,7 +33,7 @@ impl VsCodeThemeConverter { let status_color_refinements = self.convert_status_colors()?; let theme_colors_refinements = self.convert_theme_colors()?; - let mut highlight_styles = HashMap::new(); + let mut highlight_styles = IndexMap::new(); for token_color in self.theme.token_colors { highlight_styles.extend(token_color.highlight_styles()?); diff --git a/crates/theme_importer/src/vscode/syntax.rs b/crates/theme_importer/src/vscode/syntax.rs index dc906bbc4b7edf07ce49be6a6f56eb4f77798094..8f98ebad974a8701cb3881e8357d822900acafda 100644 --- a/crates/theme_importer/src/vscode/syntax.rs +++ b/crates/theme_importer/src/vscode/syntax.rs @@ -2,9 +2,8 @@ // Map tokenColors style to HighlightStyle (fontStyle, foreground, background) // Take in the scopes from the tokenColors and try to match each to our HighlightStyles -use std::collections::HashMap; - use anyhow::Result; +use indexmap::IndexMap; use serde::Deserialize; use theme::UserHighlightStyle; @@ -33,13 +32,13 @@ pub struct VsCodeTokenColorSettings { } impl VsCodeTokenColor { - pub fn highlight_styles(&self) -> Result> { - let mut highlight_styles = HashMap::new(); + pub fn highlight_styles(&self) -> Result> { + let mut highlight_styles = IndexMap::new(); let scope = match self.scope { Some(VsCodeTokenScope::One(ref scope)) => vec![scope.clone()], Some(VsCodeTokenScope::Many(ref scopes)) => scopes.clone(), - None => return Ok(HashMap::new()), + None => return Ok(IndexMap::new()), }; for scope in &scope {