Compare commits

...

5 Commits

Author SHA1 Message Date
Nate Butler
fb6cd8a78e Initial pass at theme-wide variables 2024-10-28 10:24:18 -04:00
Nate Butler
b8bbeb562c Update resolution logic to be reusable for colors 2024-10-25 22:44:04 -04:00
Nate Butler
96e801b0ef Update schema.rs
- fix incorrect keys
- add max depth
- add tests
- allow reference chains
2024-10-25 22:27:26 -04:00
Nate Butler
7c69fd534d actual, useful clippy lint 👍 2024-10-25 21:25:52 -04:00
Nate Butler
e59b94599e Allow @vars in themes 2024-10-25 21:14:00 -04:00
6 changed files with 603 additions and 572 deletions

1
Cargo.lock generated
View File

@@ -11655,6 +11655,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"collections",
"gpui",
"indexmap 1.9.3",
"log",

View File

@@ -108,13 +108,13 @@ impl ThemeRegistry {
AppearanceContent::Light => ThemeColors::light(),
AppearanceContent::Dark => ThemeColors::dark(),
};
theme_colors.refine(&user_theme.style.theme_colors_refinement());
theme_colors.refine(&user_theme.theme_colors_refinement());
let mut status_colors = match user_theme.appearance {
AppearanceContent::Light => StatusColors::light(),
AppearanceContent::Dark => StatusColors::dark(),
};
status_colors.refine(&user_theme.style.status_colors_refinement());
status_colors.refine(&user_theme.status_colors_refinement());
let mut player_colors = match user_theme.appearance {
AppearanceContent::Light => PlayerColors::light(),

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
use crate::fallback_themes::zed_default_dark;
use crate::{Appearance, SyntaxTheme, Theme, ThemeRegistry, ThemeStyleContent};
use anyhow::Result;
use collections::HashMap;
use derive_more::{Deref, DerefMut};
use gpui::{
px, AppContext, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, Global, Pixels,
@@ -465,6 +466,9 @@ impl ThemeSettings {
if let Some(theme_overrides) = &self.theme_overrides {
let mut base_theme = (*self.active_theme).clone();
// TODO: Theme overrides currently can not use variables
let base_theme_variables: HashMap<String, String> = HashMap::default();
if let Some(window_background_appearance) = theme_overrides.window_background_appearance
{
base_theme.styles.window_background_appearance =
@@ -474,11 +478,11 @@ impl ThemeSettings {
base_theme
.styles
.colors
.refine(&theme_overrides.theme_colors_refinement());
.refine(&theme_overrides.theme_colors_refinement(&base_theme_variables));
base_theme
.styles
.status
.refine(&theme_overrides.status_colors_refinement());
.refine(&theme_overrides.status_colors_refinement(&base_theme_variables));
base_theme.styles.player.merge(&theme_overrides.players);
base_theme.styles.accents.merge(&theme_overrides.accents);
base_theme.styles.syntax =

View File

@@ -11,6 +11,7 @@ workspace = true
[dependencies]
anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
collections.workspace = true
gpui.workspace = true
indexmap.workspace = true
log.workspace = true

View File

@@ -63,6 +63,7 @@ impl VsCodeThemeConverter {
players: Vec::new(),
syntax: syntax_theme,
},
variables: collections::HashMap::default(),
})
}