theme: Remove default syntax colors (#11980)
This PR removes the default syntax colors from the theme. With the changes in #11911 these colors could leak through if the theme didn't provide a value for that syntax color. Removing them gives themes a clean slate to work with. Release Notes: - N/A
This commit is contained in:
parent
8631280baa
commit
79098671e6
3 changed files with 4 additions and 128 deletions
|
@ -22,7 +22,7 @@ fn zed_pro_daylight() -> Theme {
|
||||||
colors: ThemeColors::light(),
|
colors: ThemeColors::light(),
|
||||||
status: StatusColors::light(),
|
status: StatusColors::light(),
|
||||||
player: PlayerColors::light(),
|
player: PlayerColors::light(),
|
||||||
syntax: Arc::new(SyntaxTheme::light()),
|
syntax: Arc::new(SyntaxTheme::default()),
|
||||||
accents: vec![
|
accents: vec![
|
||||||
blue().light().step_9(),
|
blue().light().step_9(),
|
||||||
orange().light().step_9(),
|
orange().light().step_9(),
|
||||||
|
@ -53,7 +53,7 @@ pub(crate) fn zed_pro_moonlight() -> Theme {
|
||||||
colors: ThemeColors::dark(),
|
colors: ThemeColors::dark(),
|
||||||
status: StatusColors::dark(),
|
status: StatusColors::dark(),
|
||||||
player: PlayerColors::dark(),
|
player: PlayerColors::dark(),
|
||||||
syntax: Arc::new(SyntaxTheme::dark()),
|
syntax: Arc::new(SyntaxTheme::default()),
|
||||||
accents: vec![
|
accents: vec![
|
||||||
blue().dark().step_9(),
|
blue().dark().step_9(),
|
||||||
orange().dark().step_9(),
|
orange().dark().step_9(),
|
||||||
|
|
|
@ -118,10 +118,6 @@ impl ThemeRegistry {
|
||||||
};
|
};
|
||||||
player_colors.merge(&user_theme.style.players);
|
player_colors.merge(&user_theme.style.players);
|
||||||
|
|
||||||
let syntax_theme = match user_theme.appearance {
|
|
||||||
AppearanceContent::Light => SyntaxTheme::light(),
|
|
||||||
AppearanceContent::Dark => SyntaxTheme::dark(),
|
|
||||||
};
|
|
||||||
let syntax_highlights = user_theme
|
let syntax_highlights = user_theme
|
||||||
.style
|
.style
|
||||||
.syntax
|
.syntax
|
||||||
|
@ -141,7 +137,8 @@ impl ThemeRegistry {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let syntax_theme = SyntaxTheme::merge(Arc::new(syntax_theme), syntax_highlights);
|
let syntax_theme =
|
||||||
|
SyntaxTheme::merge(Arc::new(SyntaxTheme::default()), syntax_highlights);
|
||||||
|
|
||||||
let window_background_appearance = user_theme
|
let window_background_appearance = user_theme
|
||||||
.style
|
.style
|
||||||
|
|
|
@ -2,133 +2,12 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use gpui::{HighlightStyle, Hsla};
|
use gpui::{HighlightStyle, Hsla};
|
||||||
|
|
||||||
use crate::{
|
|
||||||
blue, cyan, gold, indigo, iris, jade, lime, mint, neutral, orange, plum, purple, red, sky,
|
|
||||||
tomato, yellow,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Default)]
|
#[derive(Debug, PartialEq, Eq, Clone, Default)]
|
||||||
pub struct SyntaxTheme {
|
pub struct SyntaxTheme {
|
||||||
pub highlights: Vec<(String, HighlightStyle)>,
|
pub highlights: Vec<(String, HighlightStyle)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SyntaxTheme {
|
impl SyntaxTheme {
|
||||||
pub fn light() -> Self {
|
|
||||||
Self {
|
|
||||||
highlights: vec![
|
|
||||||
("attribute".into(), cyan().light().step_11().into()),
|
|
||||||
("boolean".into(), tomato().light().step_11().into()),
|
|
||||||
("comment".into(), neutral().light().step_10().into()),
|
|
||||||
("comment.doc".into(), iris().light().step_11().into()),
|
|
||||||
("constant".into(), red().light().step_9().into()),
|
|
||||||
("constructor".into(), red().light().step_9().into()),
|
|
||||||
("embedded".into(), red().light().step_9().into()),
|
|
||||||
("emphasis".into(), red().light().step_9().into()),
|
|
||||||
("emphasis.strong".into(), red().light().step_9().into()),
|
|
||||||
("enum".into(), red().light().step_9().into()),
|
|
||||||
("function".into(), red().light().step_9().into()),
|
|
||||||
("hint".into(), red().light().step_9().into()),
|
|
||||||
("keyword".into(), orange().light().step_9().into()),
|
|
||||||
("label".into(), red().light().step_9().into()),
|
|
||||||
("link_text".into(), red().light().step_9().into()),
|
|
||||||
("link_uri".into(), red().light().step_9().into()),
|
|
||||||
("number".into(), purple().light().step_10().into()),
|
|
||||||
("operator".into(), red().light().step_9().into()),
|
|
||||||
("predictive".into(), red().light().step_9().into()),
|
|
||||||
("preproc".into(), red().light().step_9().into()),
|
|
||||||
("primary".into(), red().light().step_9().into()),
|
|
||||||
("property".into(), red().light().step_9().into()),
|
|
||||||
("punctuation".into(), neutral().light().step_11().into()),
|
|
||||||
(
|
|
||||||
"punctuation.bracket".into(),
|
|
||||||
neutral().light().step_11().into(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"punctuation.delimiter".into(),
|
|
||||||
neutral().light().step_10().into(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"punctuation.list_marker".into(),
|
|
||||||
blue().light().step_11().into(),
|
|
||||||
),
|
|
||||||
("punctuation.special".into(), red().light().step_9().into()),
|
|
||||||
("string".into(), jade().light().step_9().into()),
|
|
||||||
("string.escape".into(), red().light().step_9().into()),
|
|
||||||
("string.regex".into(), tomato().light().step_9().into()),
|
|
||||||
("string.special".into(), red().light().step_9().into()),
|
|
||||||
(
|
|
||||||
"string.special.symbol".into(),
|
|
||||||
red().light().step_9().into(),
|
|
||||||
),
|
|
||||||
("tag".into(), red().light().step_9().into()),
|
|
||||||
("text.literal".into(), red().light().step_9().into()),
|
|
||||||
("title".into(), red().light().step_9().into()),
|
|
||||||
("type".into(), cyan().light().step_9().into()),
|
|
||||||
("variable".into(), red().light().step_9().into()),
|
|
||||||
("variable.special".into(), red().light().step_9().into()),
|
|
||||||
("variant".into(), red().light().step_9().into()),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn dark() -> Self {
|
|
||||||
Self {
|
|
||||||
highlights: vec![
|
|
||||||
("attribute".into(), tomato().dark().step_11().into()),
|
|
||||||
("boolean".into(), tomato().dark().step_11().into()),
|
|
||||||
("comment".into(), neutral().dark().step_11().into()),
|
|
||||||
("comment.doc".into(), iris().dark().step_12().into()),
|
|
||||||
("constant".into(), orange().dark().step_11().into()),
|
|
||||||
("constructor".into(), gold().dark().step_11().into()),
|
|
||||||
("embedded".into(), red().dark().step_11().into()),
|
|
||||||
("emphasis".into(), red().dark().step_11().into()),
|
|
||||||
("emphasis.strong".into(), red().dark().step_11().into()),
|
|
||||||
("enum".into(), yellow().dark().step_11().into()),
|
|
||||||
("function".into(), blue().dark().step_11().into()),
|
|
||||||
("hint".into(), indigo().dark().step_11().into()),
|
|
||||||
("keyword".into(), plum().dark().step_11().into()),
|
|
||||||
("label".into(), red().dark().step_11().into()),
|
|
||||||
("link_text".into(), red().dark().step_11().into()),
|
|
||||||
("link_uri".into(), red().dark().step_11().into()),
|
|
||||||
("number".into(), red().dark().step_11().into()),
|
|
||||||
("operator".into(), red().dark().step_11().into()),
|
|
||||||
("predictive".into(), red().dark().step_11().into()),
|
|
||||||
("preproc".into(), red().dark().step_11().into()),
|
|
||||||
("primary".into(), red().dark().step_11().into()),
|
|
||||||
("property".into(), red().dark().step_11().into()),
|
|
||||||
("punctuation".into(), neutral().dark().step_11().into()),
|
|
||||||
(
|
|
||||||
"punctuation.bracket".into(),
|
|
||||||
neutral().dark().step_11().into(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"punctuation.delimiter".into(),
|
|
||||||
neutral().dark().step_11().into(),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"punctuation.list_marker".into(),
|
|
||||||
blue().dark().step_11().into(),
|
|
||||||
),
|
|
||||||
("punctuation.special".into(), red().dark().step_11().into()),
|
|
||||||
("string".into(), lime().dark().step_11().into()),
|
|
||||||
("string.escape".into(), orange().dark().step_11().into()),
|
|
||||||
("string.regex".into(), tomato().dark().step_11().into()),
|
|
||||||
("string.special".into(), red().dark().step_11().into()),
|
|
||||||
(
|
|
||||||
"string.special.symbol".into(),
|
|
||||||
red().dark().step_11().into(),
|
|
||||||
),
|
|
||||||
("tag".into(), red().dark().step_11().into()),
|
|
||||||
("text.literal".into(), purple().dark().step_11().into()),
|
|
||||||
("title".into(), sky().dark().step_11().into()),
|
|
||||||
("type".into(), mint().dark().step_11().into()),
|
|
||||||
("variable".into(), red().dark().step_11().into()),
|
|
||||||
("variable.special".into(), red().dark().step_11().into()),
|
|
||||||
("variant".into(), red().dark().step_11().into()),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub fn new_test(colors: impl IntoIterator<Item = (&'static str, Hsla)>) -> Self {
|
pub fn new_test(colors: impl IntoIterator<Item = (&'static str, Hsla)>) -> Self {
|
||||||
Self::new_test_styles(colors.into_iter().map(|(key, color)| {
|
Self::new_test_styles(colors.into_iter().map(|(key, color)| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue