From 34e31fd4895b42f0dba750562d5a2be210bd02a4 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 9 Nov 2023 12:59:20 -0500 Subject: [PATCH] Properly emit `UserHighlightStyle`s --- crates/theme2/src/themes/andromeda.rs | 52 +++- crates/theme2/src/themes/ayu.rs | 76 +++++- crates/theme2/src/themes/dracula.rs | 28 ++- crates/theme2/src/themes/gruvbox.rs | 148 ++++++++++-- crates/theme2/src/themes/night_owl.rs | 52 +++- crates/theme2/src/themes/nord.rs | 28 ++- crates/theme2/src/themes/notctis.rs | 268 ++++++++++++++++++--- crates/theme2/src/themes/palenight.rs | 76 +++++- crates/theme2/src/themes/rose_pine.rs | 76 +++++- crates/theme2/src/themes/solarized.rs | 52 +++- crates/theme2/src/themes/synthwave_84.rs | 28 ++- crates/theme_importer/src/main.rs | 3 +- crates/theme_importer/src/theme_printer.rs | 29 ++- 13 files changed, 786 insertions(+), 130 deletions(-) diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index 00973f0f51..e48f58a7a2 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn andromeda() -> UserThemeFamily { @@ -61,9 +61,27 @@ pub fn andromeda() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x9fa0a6cc).into()), - ("something".into(), rgba(0x95e072ff).into()), - ("punctuation".into(), rgba(0x95e072ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x95e072ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x95e072ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x9fa0a6cc).into()), + ..Default::default() + }, + ), ], }), }, @@ -116,9 +134,27 @@ pub fn andromeda() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x95e072ff).into()), - ("comment".into(), rgba(0x9fa0a6cc).into()), - ("something".into(), rgba(0x95e072ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x95e072ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x95e072ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x9fa0a6cc).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index 47d50d96c4..0401ff46a2 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn ayu() -> UserThemeFamily { @@ -65,9 +65,27 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0xfa8d3eff).into()), - ("punctuation".into(), rgba(0x787b8099).into()), - ("comment".into(), rgba(0x787b8099).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xfa8d3eff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x787b8099).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x787b8099).into()), + ..Default::default() + }, + ), ], }), }, @@ -124,9 +142,27 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0xffad65ff).into()), - ("comment".into(), rgba(0xb8cfe680).into()), - ("punctuation".into(), rgba(0xb8cfe680).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xb8cfe680).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xffad65ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0xb8cfe680).into()), + ..Default::default() + }, + ), ], }), }, @@ -183,9 +219,27 @@ pub fn ayu() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0xabb5be8c).into()), - ("something".into(), rgba(0xff8f3fff).into()), - ("punctuation".into(), rgba(0xabb5be8c).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0xabb5be8c).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xabb5be8c).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xff8f3fff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index d8b97589ab..716ece161e 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn dracula() -> UserThemeFamily { @@ -66,9 +66,27 @@ pub fn dracula() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x6272a4ff).into()), - ("something".into(), rgba(0xf8f8f2ff).into()), - ("punctuation".into(), rgba(0xff79c6ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x6272a4ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xff79c6ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xf8f8f2ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index a7a3a42f19..1d4da9922e 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn gruvbox() -> UserThemeFamily { @@ -64,9 +64,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x928374ff).into()), - ("something".into(), rgba(0x83a598ff).into()), - ("punctuation".into(), rgba(0x83a598ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -122,9 +140,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x83a598ff).into()), - ("comment".into(), rgba(0x928374ff).into()), - ("punctuation".into(), rgba(0x83a598ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -180,9 +216,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x928374ff).into()), - ("something".into(), rgba(0x83a598ff).into()), - ("punctuation".into(), rgba(0x83a598ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x83a598ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -238,9 +292,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x928374ff).into()), - ("something".into(), rgba(0x066578ff).into()), - ("punctuation".into(), rgba(0x066578ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x066578ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x066578ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -296,9 +368,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x066578ff).into()), - ("comment".into(), rgba(0x928374ff).into()), - ("punctuation".into(), rgba(0x066578ff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x066578ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x066578ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -354,9 +444,27 @@ pub fn gruvbox() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x066578ff).into()), - ("comment".into(), rgba(0x928374ff).into()), - ("punctuation".into(), rgba(0x066578ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x928374ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x066578ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + 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 a0a11b9aa1..2d5b1bd26b 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn night_owl() -> UserThemeFamily { @@ -65,9 +65,27 @@ pub fn night_owl() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x637777ff).into()), - ("something".into(), rgba(0x7fcac3ff).into()), - ("punctuation".into(), rgba(0xd3413dff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xd3413dff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x637777ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x7fcac3ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -125,9 +143,27 @@ pub fn night_owl() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x989fb1ff).into()), - ("something".into(), rgba(0x0b969bff).into()), - ("punctuation".into(), rgba(0xd3413dff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x0b969bff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x989fb1ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xd3413dff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index eb0deed4f0..1a6e942b1f 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn nord() -> UserThemeFamily { @@ -66,9 +66,27 @@ pub fn nord() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x606e87ff).into()), - ("punctuation".into(), rgba(0x81a1c1ff).into()), - ("something".into(), rgba(0xa3be8cff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xa3be8cff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x606e87ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x81a1c1ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/notctis.rs b/crates/theme2/src/themes/notctis.rs index 437fa98298..cab9f39530 100644 --- a/crates/theme2/src/themes/notctis.rs +++ b/crates/theme2/src/themes/notctis.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn notctis() -> UserThemeFamily { @@ -67,9 +67,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x5888a5ff).into()), - ("something".into(), rgba(0x49e9a6ff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x5888a5ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -128,9 +146,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x8b737bff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), - ("something".into(), rgba(0x49e9a6ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x8b737bff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -189,9 +225,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x0094f0ff).into()), - ("something".into(), rgba(0x00b368ff).into()), - ("comment".into(), rgba(0x8ca6a6ff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x00b368ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x8ca6a6ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x0094f0ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -250,9 +304,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x9995b7ff).into()), - ("punctuation".into(), rgba(0x0094f0ff).into()), - ("something".into(), rgba(0x00b368ff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x00b368ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x9995b7ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x0094f0ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -311,9 +383,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x0094f0ff).into()), - ("comment".into(), rgba(0x8ca6a6ff).into()), - ("something".into(), rgba(0x00b368ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x0094f0ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x8ca6a6ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x00b368ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -372,9 +462,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x5897bfff).into()), - ("comment".into(), rgba(0x5d7787ff).into()), - ("something".into(), rgba(0x72c09fff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x72c09fff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x5d7787ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x5897bfff).into()), + ..Default::default() + }, + ), ], }), }, @@ -433,9 +541,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x5b858bff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), - ("something".into(), rgba(0x49e9a6ff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x5b858bff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -494,9 +620,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x49e9a6ff).into()), - ("comment".into(), rgba(0x5b858bff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x5b858bff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -555,9 +699,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x49e9a6ff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), - ("comment".into(), rgba(0x5b858bff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x5b858bff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -616,9 +778,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x49ace9ff).into()), - ("comment".into(), rgba(0x716b93ff).into()), - ("something".into(), rgba(0x49e9a6ff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x716b93ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -677,9 +857,27 @@ pub fn notctis() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x49e9a6ff).into()), - ("comment".into(), rgba(0x7e6499ff).into()), - ("punctuation".into(), rgba(0x49ace9ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x7e6499ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x49e9a6ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x49ace9ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 679fe1514c..94e0024782 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn palenight() -> UserThemeFamily { @@ -65,9 +65,27 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0xd3413dff).into()), - ("something".into(), rgba(0x7fcac3ff).into()), - ("comment".into(), rgba(0x687097ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x687097ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x7fcac3ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xd3413dff).into()), + ..Default::default() + }, + ), ], }), }, @@ -124,9 +142,27 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x7fcac3ff).into()), - ("comment".into(), rgba(0x687097ff).into()), - ("punctuation".into(), rgba(0xd3413dff).into()), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x7fcac3ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x687097ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xd3413dff).into()), + ..Default::default() + }, + ), ], }), }, @@ -183,9 +219,27 @@ pub fn palenight() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("something".into(), rgba(0x7fcac3ff).into()), - ("comment".into(), rgba(0x687097ff).into()), - ("punctuation".into(), rgba(0xd3413dff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x687097ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x7fcac3ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xd3413dff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index 353fcd10d3..6d5f6b256d 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn rose_pine() -> UserThemeFamily { @@ -66,9 +66,27 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("punctuation".into(), rgba(0x6e6a86ff).into()), - ("comment".into(), rgba(0x6e6a86ff).into()), - ("something".into(), rgba(0xebbcbaff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x6e6a86ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xebbcbaff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x6e6a86ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -126,9 +144,27 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x6e6a86ff).into()), - ("something".into(), rgba(0xea9a97ff).into()), - ("punctuation".into(), rgba(0x6e6a86ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x6e6a86ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xea9a97ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x6e6a86ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -186,9 +222,27 @@ pub fn rose_pine() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x9893a5ff).into()), - ("punctuation".into(), rgba(0x9893a5ff).into()), - ("something".into(), rgba(0xd7827dff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x9893a5ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x9893a5ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xd7827dff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index e970dd7b0c..538beff8ba 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn solarized() -> UserThemeFamily { @@ -61,9 +61,27 @@ pub fn solarized() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x657b83ff).into()), - ("something".into(), rgba(0x93a1a1ff).into()), - ("punctuation".into(), rgba(0x657b83ff).into()), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x657b83ff).into()), + ..Default::default() + }, + ), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x657b83ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + ..Default::default() + }, + ), ], }), }, @@ -113,9 +131,27 @@ pub fn solarized() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x93a1a1ff).into()), - ("punctuation".into(), rgba(0x93a1a1ff).into()), - ("something".into(), rgba(0x657b83ff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0x93a1a1ff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0x657b83ff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index 2eef9e908f..eec0fe4e14 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -4,8 +4,8 @@ use gpui::rgba; use crate::{ - Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserTheme, UserThemeFamily, - UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }; pub fn synthwave_84() -> UserThemeFamily { @@ -51,9 +51,27 @@ pub fn synthwave_84() -> UserThemeFamily { }, syntax: Some(UserSyntaxTheme { highlights: vec![ - ("comment".into(), rgba(0x848bbdff).into()), - ("something".into(), rgba(0xfe444fff).into()), - ("punctuation".into(), rgba(0xfede5cff).into()), + ( + "comment".into(), + UserHighlightStyle { + color: Some(rgba(0x848bbdff).into()), + ..Default::default() + }, + ), + ( + "punctuation".into(), + UserHighlightStyle { + color: Some(rgba(0xfede5cff).into()), + ..Default::default() + }, + ), + ( + "something".into(), + UserHighlightStyle { + color: Some(rgba(0xfe444fff).into()), + ..Default::default() + }, + ), ], }), }, diff --git a/crates/theme_importer/src/main.rs b/crates/theme_importer/src/main.rs index a92e753f85..052ee5cf3a 100644 --- a/crates/theme_importer/src/main.rs +++ b/crates/theme_importer/src/main.rs @@ -160,7 +160,8 @@ fn main() -> Result<()> { use gpui::rgba; use crate::{{ - Appearance, ThemeColorsRefinement, StatusColorsRefinement, UserTheme, UserThemeFamily, UserThemeStylesRefinement, + Appearance, StatusColorsRefinement, ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, + UserTheme, UserThemeFamily, UserThemeStylesRefinement, }}; pub fn {theme_family_slug}() -> UserThemeFamily {{ diff --git a/crates/theme_importer/src/theme_printer.rs b/crates/theme_importer/src/theme_printer.rs index e114584d83..f99030b4aa 100644 --- a/crates/theme_importer/src/theme_printer.rs +++ b/crates/theme_importer/src/theme_printer.rs @@ -3,7 +3,8 @@ use std::fmt::{self, Debug}; use gpui::{Hsla, Rgba}; use theme::{ Appearance, PlayerColor, PlayerColors, StatusColorsRefinement, SystemColors, - ThemeColorsRefinement, UserSyntaxTheme, UserTheme, UserThemeFamily, UserThemeStylesRefinement, + ThemeColorsRefinement, UserHighlightStyle, UserSyntaxTheme, UserTheme, UserThemeFamily, + UserThemeStylesRefinement, }; struct RawSyntaxPrinter<'a>(&'a str); @@ -350,7 +351,7 @@ impl<'a> Debug for UserSyntaxThemePrinter<'a> { .highlights .iter() .map(|(token, highlight)| { - (IntoPrinter(token), HslaPrinter(highlight.color.unwrap())) + (IntoPrinter(token), UserHighlightStylePrinter(&highlight)) }) .collect(), ), @@ -358,3 +359,27 @@ impl<'a> Debug for UserSyntaxThemePrinter<'a> { .finish() } } + +pub struct UserHighlightStylePrinter<'a>(&'a UserHighlightStyle); + +impl<'a> Debug for UserHighlightStylePrinter<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let fields = vec![("color", self.0.color)]; + + f.write_str("UserHighlightStyle {")?; + + for (field_name, value) in fields { + if let Some(color) = value { + f.write_str(field_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("}") + } +}