Compare commits

...

1 Commits

Author SHA1 Message Date
Marshall Bowers
94865da1e8 theme: Replace all fallback colors with #ff00ff 2025-05-17 13:13:16 +02:00
3 changed files with 179 additions and 238 deletions

View File

@@ -1,22 +1,22 @@
use std::sync::Arc;
use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance, hsla};
use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance};
use crate::{
AccentColors, Appearance, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme,
SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, default_color_scales,
};
/// The default theme family for Zed.
/// The fallback theme family for Zed.
///
/// This is used to construct the default theme fallback values, as well as to
/// have a theme available at compile time for tests.
pub fn zed_default_themes() -> ThemeFamily {
pub fn zed_fallback_themes() -> ThemeFamily {
ThemeFamily {
id: "zed-default".to_string(),
name: "Zed Default".into(),
id: "zed-fallback".to_string(),
name: "Zed Fallback".into(),
author: "".into(),
themes: vec![zed_default_dark()],
themes: vec![zed_fallback_theme()],
scales: default_color_scales(),
}
}
@@ -41,243 +41,184 @@ pub(crate) fn apply_status_color_defaults(status: &mut StatusColorsRefinement) {
}
}
pub(crate) fn zed_default_dark() -> Theme {
let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.);
let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
let elevated_surface = hsla(225. / 360., 12. / 100., 17. / 100., 1.);
let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0);
let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
let green = hsla(95. / 360., 38. / 100., 62. / 100., 1.0);
let orange = hsla(29. / 360., 54. / 100., 61. / 100., 1.0);
let purple = hsla(286. / 360., 51. / 100., 64. / 100., 1.0);
let red = hsla(355. / 360., 65. / 100., 65. / 100., 1.0);
let teal = hsla(187. / 360., 47. / 100., 55. / 100., 1.0);
let yellow = hsla(39. / 360., 67. / 100., 69. / 100., 1.0);
const ADDED_COLOR: Hsla = Hsla {
h: 142. / 360.,
s: 0.68,
l: 0.45,
a: 1.0,
};
const MODIFIED_COLOR: Hsla = Hsla {
h: 48. / 360.,
s: 0.76,
l: 0.47,
a: 1.0,
};
const REMOVED_COLOR: Hsla = Hsla {
h: 355. / 360.,
s: 0.65,
l: 0.65,
a: 1.0,
};
pub(crate) fn zed_fallback_theme() -> Theme {
let magenta: Hsla = gpui::rgb(0xff00ff).into();
Theme {
id: "one_dark".to_string(),
// We use "One Dark" as the theme name here so that when we load the real One Dark it will override this one.
name: "One Dark".into(),
appearance: Appearance::Dark,
styles: ThemeStyles {
window_background_appearance: WindowBackgroundAppearance::Opaque,
system: SystemColors::default(),
accents: AccentColors(vec![blue, orange, purple, teal, red, green, yellow]),
accents: AccentColors(vec![magenta]),
colors: ThemeColors {
border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
border_variant: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
border_focused: hsla(223. / 360., 78. / 100., 65. / 100., 1.),
border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
border: magenta,
border_variant: magenta,
border_focused: magenta,
border_selected: magenta,
border_transparent: SystemColors::default().transparent,
border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
elevated_surface_background: elevated_surface,
surface_background: bg,
background: bg,
element_background: hsla(223.0 / 360., 13. / 100., 21. / 100., 1.0),
element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
border_disabled: magenta,
elevated_surface_background: magenta,
surface_background: magenta,
background: magenta,
element_background: magenta,
element_hover: magenta,
element_active: magenta,
element_selected: magenta,
element_disabled: SystemColors::default().transparent,
drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0),
drop_target_background: magenta,
ghost_element_background: SystemColors::default().transparent,
ghost_element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
ghost_element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
ghost_element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
ghost_element_hover: magenta,
ghost_element_active: magenta,
ghost_element_selected: magenta,
ghost_element_disabled: SystemColors::default().transparent,
text: hsla(221. / 360., 11. / 100., 86. / 100., 1.0),
text_muted: hsla(218.0 / 360., 7. / 100., 46. / 100., 1.0),
text_placeholder: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
text_disabled: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
text_accent: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
icon: hsla(222.9 / 360., 9.9 / 100., 86.1 / 100., 1.0),
icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
icon_accent: blue,
debugger_accent: red,
status_bar_background: bg,
title_bar_background: bg,
title_bar_inactive_background: bg,
toolbar_background: editor,
tab_bar_background: bg,
tab_inactive_background: bg,
tab_active_background: editor,
search_match_background: bg,
editor_background: editor,
editor_gutter_background: editor,
editor_subheader_background: bg,
editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
editor_debugger_active_line_background: hsla(
207.8 / 360.,
81. / 100.,
66. / 100.,
0.2,
),
editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
editor_hover_line_number: hsla(216.0 / 360., 5.9 / 100., 56.7 / 100., 1.0),
editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
editor_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
editor_active_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
editor_indent_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
editor_indent_guide_active: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
editor_document_highlight_read_background: hsla(
207.8 / 360.,
81. / 100.,
66. / 100.,
0.2,
),
editor_document_highlight_write_background: gpui::red(),
editor_document_highlight_bracket_background: gpui::green(),
terminal_background: bg,
// todo("Use one colors for terminal")
terminal_ansi_background: crate::black().dark().step_12(),
terminal_foreground: crate::white().dark().step_12(),
terminal_bright_foreground: crate::white().dark().step_11(),
terminal_dim_foreground: crate::white().dark().step_10(),
terminal_ansi_black: crate::black().dark().step_12(),
terminal_ansi_red: crate::red().dark().step_11(),
terminal_ansi_green: crate::green().dark().step_11(),
terminal_ansi_yellow: crate::yellow().dark().step_11(),
terminal_ansi_blue: crate::blue().dark().step_11(),
terminal_ansi_magenta: crate::violet().dark().step_11(),
terminal_ansi_cyan: crate::cyan().dark().step_11(),
terminal_ansi_white: crate::neutral().dark().step_12(),
terminal_ansi_bright_black: crate::black().dark().step_11(),
terminal_ansi_bright_red: crate::red().dark().step_10(),
terminal_ansi_bright_green: crate::green().dark().step_10(),
terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
terminal_ansi_bright_blue: crate::blue().dark().step_10(),
terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
terminal_ansi_bright_white: crate::neutral().dark().step_11(),
terminal_ansi_dim_black: crate::black().dark().step_10(),
terminal_ansi_dim_red: crate::red().dark().step_9(),
terminal_ansi_dim_green: crate::green().dark().step_9(),
terminal_ansi_dim_yellow: crate::yellow().dark().step_9(),
terminal_ansi_dim_blue: crate::blue().dark().step_9(),
terminal_ansi_dim_magenta: crate::violet().dark().step_9(),
terminal_ansi_dim_cyan: crate::cyan().dark().step_9(),
terminal_ansi_dim_white: crate::neutral().dark().step_10(),
panel_background: bg,
panel_focused_border: blue,
panel_indent_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
panel_indent_guide_hover: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
panel_indent_guide_active: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
pane_focused_border: blue,
pane_group_border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
text: magenta,
text_muted: magenta,
text_placeholder: magenta,
text_disabled: magenta,
text_accent: magenta,
icon: magenta,
icon_muted: magenta,
icon_disabled: magenta,
icon_placeholder: magenta,
icon_accent: magenta,
debugger_accent: magenta,
status_bar_background: magenta,
title_bar_background: magenta,
title_bar_inactive_background: magenta,
toolbar_background: magenta,
tab_bar_background: magenta,
tab_inactive_background: magenta,
tab_active_background: magenta,
search_match_background: magenta,
editor_background: magenta,
editor_gutter_background: magenta,
editor_subheader_background: magenta,
editor_active_line_background: magenta,
editor_highlighted_line_background: magenta,
editor_debugger_active_line_background: magenta,
editor_line_number: magenta,
editor_active_line_number: magenta,
editor_hover_line_number: magenta,
editor_invisible: magenta,
editor_wrap_guide: magenta,
editor_active_wrap_guide: magenta,
editor_indent_guide: magenta,
editor_indent_guide_active: magenta,
editor_document_highlight_read_background: magenta,
editor_document_highlight_write_background: magenta,
editor_document_highlight_bracket_background: magenta,
terminal_background: magenta,
terminal_ansi_background: magenta,
terminal_foreground: magenta,
terminal_bright_foreground: magenta,
terminal_dim_foreground: magenta,
terminal_ansi_black: magenta,
terminal_ansi_red: magenta,
terminal_ansi_green: magenta,
terminal_ansi_yellow: magenta,
terminal_ansi_blue: magenta,
terminal_ansi_magenta: magenta,
terminal_ansi_cyan: magenta,
terminal_ansi_white: magenta,
terminal_ansi_bright_black: magenta,
terminal_ansi_bright_red: magenta,
terminal_ansi_bright_green: magenta,
terminal_ansi_bright_yellow: magenta,
terminal_ansi_bright_blue: magenta,
terminal_ansi_bright_magenta: magenta,
terminal_ansi_bright_cyan: magenta,
terminal_ansi_bright_white: magenta,
terminal_ansi_dim_black: magenta,
terminal_ansi_dim_red: magenta,
terminal_ansi_dim_green: magenta,
terminal_ansi_dim_yellow: magenta,
terminal_ansi_dim_blue: magenta,
terminal_ansi_dim_magenta: magenta,
terminal_ansi_dim_cyan: magenta,
terminal_ansi_dim_white: magenta,
panel_background: magenta,
panel_focused_border: magenta,
panel_indent_guide: magenta,
panel_indent_guide_hover: magenta,
panel_indent_guide_active: magenta,
pane_focused_border: magenta,
pane_group_border: magenta,
scrollbar_thumb_background: gpui::transparent_black(),
scrollbar_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
scrollbar_thumb_active_background: hsla(
225.0 / 360.,
11.8 / 100.,
26.7 / 100.,
1.0,
),
scrollbar_thumb_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
scrollbar_thumb_hover_background: magenta,
scrollbar_thumb_active_background: magenta,
scrollbar_thumb_border: magenta,
scrollbar_track_background: gpui::transparent_black(),
scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
editor_foreground: hsla(218. / 360., 14. / 100., 71. / 100., 1.),
link_text_hover: blue,
version_control_added: ADDED_COLOR,
version_control_deleted: REMOVED_COLOR,
version_control_modified: MODIFIED_COLOR,
version_control_renamed: MODIFIED_COLOR,
version_control_conflict: crate::orange().light().step_12(),
version_control_ignored: crate::gray().light().step_12(),
version_control_conflict_ours_background: crate::green()
.light()
.step_12()
.alpha(0.5),
version_control_conflict_theirs_background: crate::blue()
.light()
.step_12()
.alpha(0.5),
version_control_conflict_ours_marker_background: crate::green()
.light()
.step_12()
.alpha(0.7),
version_control_conflict_theirs_marker_background: crate::blue()
.light()
.step_12()
.alpha(0.7),
version_control_conflict_divider_background: Hsla::default(),
scrollbar_track_border: magenta,
editor_foreground: magenta,
link_text_hover: magenta,
version_control_added: magenta,
version_control_deleted: magenta,
version_control_modified: magenta,
version_control_renamed: magenta,
version_control_conflict: magenta,
version_control_ignored: magenta,
version_control_conflict_ours_background: magenta,
version_control_conflict_theirs_background: magenta,
version_control_conflict_ours_marker_background: magenta,
version_control_conflict_theirs_marker_background: magenta,
version_control_conflict_divider_background: magenta,
},
status: StatusColors {
conflict: yellow,
conflict_background: yellow,
conflict_border: yellow,
created: green,
created_background: green,
created_border: green,
deleted: red,
deleted_background: red,
deleted_border: red,
error: red,
error_background: red,
error_border: red,
hidden: gray,
hidden_background: gray,
hidden_border: gray,
hint: blue,
hint_background: blue,
hint_border: blue,
ignored: gray,
ignored_background: gray,
ignored_border: gray,
info: blue,
info_background: blue,
info_border: blue,
modified: yellow,
modified_background: yellow,
modified_border: yellow,
predictive: gray,
predictive_background: gray,
predictive_border: gray,
renamed: blue,
renamed_background: blue,
renamed_border: blue,
success: green,
success_background: green,
success_border: green,
unreachable: gray,
unreachable_background: gray,
unreachable_border: gray,
warning: yellow,
warning_background: yellow,
warning_border: yellow,
conflict: magenta,
conflict_background: magenta,
conflict_border: magenta,
created: magenta,
created_background: magenta,
created_border: magenta,
deleted: magenta,
deleted_background: magenta,
deleted_border: magenta,
error: magenta,
error_background: magenta,
error_border: magenta,
hidden: magenta,
hidden_background: magenta,
hidden_border: magenta,
hint: magenta,
hint_background: magenta,
hint_border: magenta,
ignored: magenta,
ignored_background: magenta,
ignored_border: magenta,
info: magenta,
info_background: magenta,
info_border: magenta,
modified: magenta,
modified_background: magenta,
modified_border: magenta,
predictive: magenta,
predictive_background: magenta,
predictive_border: magenta,
renamed: magenta,
renamed_background: magenta,
renamed_border: magenta,
success: magenta,
success_background: magenta,
success_border: magenta,
unreachable: magenta,
unreachable_background: magenta,
unreachable_border: magenta,
warning: magenta,
warning_background: magenta,
warning_border: magenta,
},
player: PlayerColors::dark(),
syntax: Arc::new(SyntaxTheme {
highlights: vec![
("attribute".into(), purple.into()),
("boolean".into(), orange.into()),
("comment".into(), gray.into()),
("comment.doc".into(), gray.into()),
("constant".into(), yellow.into()),
("constructor".into(), blue.into()),
("attribute".into(), magenta.into()),
("boolean".into(), magenta.into()),
("comment".into(), magenta.into()),
("comment.doc".into(), magenta.into()),
("constant".into(), magenta.into()),
("constructor".into(), magenta.into()),
("embedded".into(), HighlightStyle::default()),
(
"emphasis".into(),
@@ -294,43 +235,43 @@ pub(crate) fn zed_default_dark() -> Theme {
},
),
("enum".into(), HighlightStyle::default()),
("function".into(), blue.into()),
("function.method".into(), blue.into()),
("function.definition".into(), blue.into()),
("hint".into(), blue.into()),
("keyword".into(), purple.into()),
("function".into(), magenta.into()),
("function.method".into(), magenta.into()),
("function.definition".into(), magenta.into()),
("hint".into(), magenta.into()),
("keyword".into(), magenta.into()),
("label".into(), HighlightStyle::default()),
("link_text".into(), blue.into()),
("link_text".into(), magenta.into()),
(
"link_uri".into(),
HighlightStyle {
color: Some(teal),
color: Some(magenta),
font_style: Some(FontStyle::Italic),
..HighlightStyle::default()
},
),
("number".into(), orange.into()),
("number".into(), magenta.into()),
("operator".into(), HighlightStyle::default()),
("predictive".into(), HighlightStyle::default()),
("preproc".into(), HighlightStyle::default()),
("primary".into(), HighlightStyle::default()),
("property".into(), red.into()),
("property".into(), magenta.into()),
("punctuation".into(), HighlightStyle::default()),
("punctuation.bracket".into(), HighlightStyle::default()),
("punctuation.delimiter".into(), HighlightStyle::default()),
("punctuation.list_marker".into(), HighlightStyle::default()),
("punctuation.special".into(), HighlightStyle::default()),
("string".into(), green.into()),
("string".into(), magenta.into()),
("string.escape".into(), HighlightStyle::default()),
("string.regex".into(), red.into()),
("string.regex".into(), magenta.into()),
("string.special".into(), HighlightStyle::default()),
("string.special.symbol".into(), HighlightStyle::default()),
("tag".into(), HighlightStyle::default()),
("text.literal".into(), HighlightStyle::default()),
("title".into(), HighlightStyle::default()),
("type".into(), teal.into()),
("type".into(), magenta.into()),
("variable".into(), HighlightStyle::default()),
("variable.special".into(), red.into()),
("variable.special".into(), magenta.into()),
("variant".into(), HighlightStyle::default()),
],
}),

View File

@@ -91,7 +91,7 @@ impl ThemeRegistry {
// We're loading the Zed default theme, as we need a theme to be loaded
// for tests.
registry.insert_theme_families([crate::fallback_themes::zed_default_themes()]);
registry.insert_theme_families([crate::fallback_themes::zed_fallback_themes()]);
let default_icon_theme = crate::default_icon_theme();
registry

View File

@@ -1,4 +1,4 @@
use crate::fallback_themes::zed_default_dark;
use crate::fallback_themes::zed_fallback_theme;
use crate::{
Appearance, DEFAULT_ICON_THEME_NAME, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme,
ThemeNotFoundError, ThemeRegistry, ThemeStyleContent,
@@ -832,7 +832,7 @@ impl settings::Settings for ThemeSettings {
theme_selection: defaults.theme.clone(),
active_theme: themes
.get(defaults.theme.as_ref().unwrap().theme(*system_appearance))
.or(themes.get(&zed_default_dark().name))
.or(themes.get(&zed_fallback_theme().name))
.unwrap(),
theme_overrides: None,
icon_theme_selection: defaults.icon_theme.clone(),