diff --git a/assets/themes/one/one.json b/assets/themes/one/one.json index 384ad28272f0239bc18b59ddb43b290aafe5920b..2484a5489195f0b8bf8f085107940264505cbe61 100644 --- a/assets/themes/one/one.json +++ b/assets/themes/one/one.json @@ -6,398 +6,7 @@ { "name": "One Dark", "appearance": "dark", - "style": { - "border": "#464b57ff", - "border.variant": "#363c46ff", - "border.focused": "#47679eff", - "border.selected": "#293b5bff", - "border.transparent": "#00000000", - "border.disabled": "#414754ff", - "elevated_surface.background": "#2f343eff", - "surface.background": "#2f343eff", - "background": "#3b414dff", - "element.background": "#2e343eff", - "element.hover": "#363c46ff", - "element.active": "#454a56ff", - "element.selected": "#454a56ff", - "element.disabled": "#2e343eff", - "drop_target.background": "#83899480", - "ghost_element.background": "#00000000", - "ghost_element.hover": "#363c46ff", - "ghost_element.active": "#454a56ff", - "ghost_element.selected": "#454a56ff", - "ghost_element.disabled": "#2e343eff", - "text": "#dce0e5ff", - "text.muted": "#a9afbcff", - "text.placeholder": "#878a98ff", - "text.disabled": "#878a98ff", - "text.accent": "#74ade8ff", - "icon": "#dce0e5ff", - "icon.muted": "#a9afbcff", - "icon.disabled": "#878a98ff", - "icon.placeholder": "#a9afbcff", - "icon.accent": "#74ade8ff", - "status_bar.background": "#3b414dff", - "title_bar.background": "#3b414dff", - "title_bar.inactive_background": "#2e343eff", - "toolbar.background": "#282c33ff", - "tab_bar.background": "#2f343eff", - "tab.inactive_background": "#2f343eff", - "tab.active_background": "#282c33ff", - "search.match_background": "#74ade866", - "panel.background": "#2f343eff", - "panel.focused_border": null, - "pane.focused_border": null, - "scrollbar.thumb.background": "#c8ccd44c", - "scrollbar.thumb.hover_background": "#363c46ff", - "scrollbar.thumb.border": "#363c46ff", - "scrollbar.track.background": "#00000000", - "scrollbar.track.border": "#2e333cff", - "editor.foreground": "#acb2beff", - "editor.background": "#282c33ff", - "editor.gutter.background": "#282c33ff", - "editor.subheader.background": "#2f343eff", - "editor.active_line.background": "#2f343ebf", - "editor.highlighted_line.background": "#2f343eff", - "editor.line_number": "#4e5a5f", - "editor.active_line_number": "#d0d4da", - "editor.hover_line_number": "#acb0b4", - "editor.invisible": "#878a98ff", - "editor.wrap_guide": "#c8ccd40d", - "editor.active_wrap_guide": "#c8ccd41a", - "editor.document_highlight.read_background": "#74ade81a", - "editor.document_highlight.write_background": "#555a6366", - "terminal.background": "#282c33ff", - "terminal.foreground": "#dce0e5ff", - "terminal.bright_foreground": "#dce0e5ff", - "terminal.dim_foreground": "#282c33ff", - "terminal.ansi.black": "#282c33ff", - "terminal.ansi.bright_black": "#525561ff", - "terminal.ansi.dim_black": "#dce0e5ff", - "terminal.ansi.red": "#d07277ff", - "terminal.ansi.bright_red": "#673a3cff", - "terminal.ansi.dim_red": "#eab7b9ff", - "terminal.ansi.green": "#a1c181ff", - "terminal.ansi.bright_green": "#4d6140ff", - "terminal.ansi.dim_green": "#d1e0bfff", - "terminal.ansi.yellow": "#dec184ff", - "terminal.ansi.bright_yellow": "#e5c07bff", - "terminal.ansi.dim_yellow": "#f1dfc1ff", - "terminal.ansi.blue": "#74ade8ff", - "terminal.ansi.bright_blue": "#385378ff", - "terminal.ansi.dim_blue": "#bed5f4ff", - "terminal.ansi.magenta": "#be5046ff", - "terminal.ansi.bright_magenta": "#5e2b26ff", - "terminal.ansi.dim_magenta": "#e6a79eff", - "terminal.ansi.cyan": "#6eb4bfff", - "terminal.ansi.bright_cyan": "#3a565bff", - "terminal.ansi.dim_cyan": "#b9d9dfff", - "terminal.ansi.white": "#dce0e5ff", - "terminal.ansi.bright_white": "#dce0e5ff", - "terminal.ansi.dim_white": "#575d65ff", - "link_text.hover": "#74ade8ff", - "version_control.added": "#27a657ff", - "version_control.modified": "#d3b020ff", - "version_control.deleted": "#e06c76ff", - "version_control.conflict_marker.ours": "#a1c1811a", - "version_control.conflict_marker.theirs": "#74ade81a", - "conflict": "#dec184ff", - "conflict.background": "#dec1841a", - "conflict.border": "#5d4c2fff", - "created": "#a1c181ff", - "created.background": "#a1c1811a", - "created.border": "#38482fff", - "deleted": "#d07277ff", - "deleted.background": "#d072771a", - "deleted.border": "#4c2b2cff", - "error": "#d07277ff", - "error.background": "#d072771a", - "error.border": "#4c2b2cff", - "hidden": "#878a98ff", - "hidden.background": "#696b771a", - "hidden.border": "#414754ff", - "hint": "#788ca6ff", - "hint.background": "#5a6f891a", - "hint.border": "#293b5bff", - "ignored": "#878a98ff", - "ignored.background": "#696b771a", - "ignored.border": "#464b57ff", - "info": "#74ade8ff", - "info.background": "#74ade81a", - "info.border": "#293b5bff", - "modified": "#dec184ff", - "modified.background": "#dec1841a", - "modified.border": "#5d4c2fff", - "predictive": "#5a6a87ff", - "predictive.background": "#5a6a871a", - "predictive.border": "#38482fff", - "renamed": "#74ade8ff", - "renamed.background": "#74ade81a", - "renamed.border": "#293b5bff", - "success": "#a1c181ff", - "success.background": "#a1c1811a", - "success.border": "#38482fff", - "unreachable": "#a9afbcff", - "unreachable.background": "#8389941a", - "unreachable.border": "#464b57ff", - "warning": "#dec184ff", - "warning.background": "#dec1841a", - "warning.border": "#5d4c2fff", - "players": [ - { - "cursor": "#74ade8ff", - "background": "#74ade8ff", - "selection": "#74ade83d" - }, - { - "cursor": "#be5046ff", - "background": "#be5046ff", - "selection": "#be50463d" - }, - { - "cursor": "#bf956aff", - "background": "#bf956aff", - "selection": "#bf956a3d" - }, - { - "cursor": "#b477cfff", - "background": "#b477cfff", - "selection": "#b477cf3d" - }, - { - "cursor": "#6eb4bfff", - "background": "#6eb4bfff", - "selection": "#6eb4bf3d" - }, - { - "cursor": "#d07277ff", - "background": "#d07277ff", - "selection": "#d072773d" - }, - { - "cursor": "#dec184ff", - "background": "#dec184ff", - "selection": "#dec1843d" - }, - { - "cursor": "#a1c181ff", - "background": "#a1c181ff", - "selection": "#a1c1813d" - } - ], - "syntax": { - "attribute": { - "color": "#74ade8ff", - "font_style": null, - "font_weight": null - }, - "boolean": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "comment": { - "color": "#5d636fff", - "font_style": null, - "font_weight": null - }, - "comment.doc": { - "color": "#878e98ff", - "font_style": null, - "font_weight": null - }, - "constant": { - "color": "#dfc184ff", - "font_style": null, - "font_weight": null - }, - "constructor": { - "color": "#73ade9ff", - "font_style": null, - "font_weight": null - }, - "embedded": { - "color": "#dce0e5ff", - "font_style": null, - "font_weight": null - }, - "emphasis": { - "color": "#74ade8ff", - "font_style": null, - "font_weight": null - }, - "emphasis.strong": { - "color": "#bf956aff", - "font_style": null, - "font_weight": 700 - }, - "enum": { - "color": "#d07277ff", - "font_style": null, - "font_weight": null - }, - "function": { - "color": "#73ade9ff", - "font_style": null, - "font_weight": null - }, - "hint": { - "color": "#788ca6ff", - "font_style": null, - "font_weight": 700 - }, - "keyword": { - "color": "#b477cfff", - "font_style": null, - "font_weight": null - }, - "label": { - "color": "#74ade8ff", - "font_style": null, - "font_weight": null - }, - "link_text": { - "color": "#73ade9ff", - "font_style": "normal", - "font_weight": null - }, - "link_uri": { - "color": "#6eb4bfff", - "font_style": null, - "font_weight": null - }, - "namespace": { - "color": "#dce0e5ff", - "font_style": null, - "font_weight": null - }, - "number": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "operator": { - "color": "#6eb4bfff", - "font_style": null, - "font_weight": null - }, - "predictive": { - "color": "#5a6a87ff", - "font_style": "italic", - "font_weight": null - }, - "preproc": { - "color": "#dce0e5ff", - "font_style": null, - "font_weight": null - }, - "primary": { - "color": "#acb2beff", - "font_style": null, - "font_weight": null - }, - "property": { - "color": "#d07277ff", - "font_style": null, - "font_weight": null - }, - "punctuation": { - "color": "#acb2beff", - "font_style": null, - "font_weight": null - }, - "punctuation.bracket": { - "color": "#b2b9c6ff", - "font_style": null, - "font_weight": null - }, - "punctuation.delimiter": { - "color": "#b2b9c6ff", - "font_style": null, - "font_weight": null - }, - "punctuation.list_marker": { - "color": "#d07277ff", - "font_style": null, - "font_weight": null - }, - "punctuation.special": { - "color": "#b1574bff", - "font_style": null, - "font_weight": null - }, - "selector": { - "color": "#dfc184ff", - "font_style": null, - "font_weight": null - }, - "selector.pseudo": { - "color": "#74ade8ff", - "font_style": null, - "font_weight": null - }, - "string": { - "color": "#a1c181ff", - "font_style": null, - "font_weight": null - }, - "string.escape": { - "color": "#878e98ff", - "font_style": null, - "font_weight": null - }, - "string.regex": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "string.special": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "string.special.symbol": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "tag": { - "color": "#74ade8ff", - "font_style": null, - "font_weight": null - }, - "text.literal": { - "color": "#a1c181ff", - "font_style": null, - "font_weight": null - }, - "title": { - "color": "#d07277ff", - "font_style": null, - "font_weight": 400 - }, - "type": { - "color": "#6eb4bfff", - "font_style": null, - "font_weight": null - }, - "variable": { - "color": "#acb2beff", - "font_style": null, - "font_weight": null - }, - "variable.special": { - "color": "#bf956aff", - "font_style": null, - "font_weight": null - }, - "variant": { - "color": "#73ade9ff", - "font_style": null, - "font_weight": null - } - } - } + "style": {} }, { "name": "One Light", diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 6d529287a778e1b56994f80084dfb52f33d1e893..cc37df2113109e553b7c516d7a72591f8a20c792 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -571,7 +571,7 @@ impl Default for EditorStyle { // HACK: Status colors don't have a real default. // We should look into removing the status colors from the editor // style and retrieve them directly from the theme. - status: StatusColors::dark(), + status: StatusColors::default(), inlay_hints_style: HighlightStyle::default(), inline_completion_styles: InlineCompletionStyles { insertion: HighlightStyle::default(), diff --git a/crates/theme/src/default.rs b/crates/theme/src/default.rs new file mode 100644 index 0000000000000000000000000000000000000000..d2fd1f04bfd23f175758adcd226684311c48cd5d --- /dev/null +++ b/crates/theme/src/default.rs @@ -0,0 +1,1353 @@ +use std::sync::Arc; + +use crate::{ + AccentColors, Appearance, PlayerColor, PlayerColors, StatusColors, SyntaxTheme, SystemColors, + Theme, ThemeColors, ThemeFamily, ThemeStyles, try_parse_color, +}; +use gpui::{HighlightStyle, Hsla, WindowBackgroundAppearance, hsla}; + +pub const DEFAULT_DARK_THEME_NAME: &str = "One Dark"; +pub const DEFAULT_LIGHT_THEME_NAME: &str = "One Light"; + +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 fn default_theme_family() -> ThemeFamily { + ThemeFamily { + id: "one".to_string(), + name: "One".into(), + author: "Zed Industries".into(), + themes: vec![default_dark_theme(), default_light_theme()], + } +} + +pub fn default_dark_theme() -> Theme { + Theme { + id: "one-dark".to_string(), + name: "One Dark".into(), + appearance: Appearance::Dark, + styles: ThemeStyles { + window_background_appearance: WindowBackgroundAppearance::Opaque, + system: SystemColors::default(), + // todo!("put in actual accent colors") + accents: AccentColors(vec![ + try_parse_color("#61afef").unwrap_or(hsla(0., 0., 0.15, 1.)), + ]), + colors: ThemeColors { + border: try_parse_color("#181a1f").unwrap_or(hsla(0., 0., 0.1, 1.)), + border_variant: try_parse_color("#181a1f").unwrap_or(hsla(0., 0., 0.1, 1.)), + border_focused: try_parse_color("#2e60bc").unwrap_or(hsla(0.6, 0.7, 0.5, 1.)), + border_selected: try_parse_color("#4370c4").unwrap_or(hsla(0.6, 0.6, 0.6, 1.)), + border_transparent: hsla(0., 0., 0., 0.), + border_disabled: try_parse_color("#242629").unwrap_or(hsla(0., 0., 0.15, 1.)), + elevated_surface_background: try_parse_color("#2c313a") + .unwrap_or(hsla(0., 0., 0.2, 1.)), + surface_background: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + background: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + element_background: try_parse_color("#2c313a").unwrap_or(hsla(0., 0., 0.2, 1.)), + element_hover: try_parse_color("#2c313a80").unwrap_or(hsla(0., 0., 0.2, 0.5)), + element_active: try_parse_color("#2c313a20").unwrap_or(hsla(0., 0., 0.2, 0.125)), + element_selected: try_parse_color("#2c313a").unwrap_or(hsla(0., 0., 0.2, 1.)), + element_selection_background: try_parse_color("#4370c43d") + .unwrap_or(hsla(0.6, 0.6, 0.6, 0.24)), + element_disabled: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + drop_target_background: try_parse_color("#FF00FF7F") + .unwrap_or(hsla(0.83, 1., 0.5, 0.5)), + ghost_element_background: hsla(0., 0., 0., 0.), + ghost_element_hover: try_parse_color("#2c313a80").unwrap_or(hsla(0., 0., 0.2, 0.5)), + ghost_element_active: try_parse_color("#2c313a20") + .unwrap_or(hsla(0., 0., 0.2, 0.125)), + ghost_element_selected: try_parse_color("#2c313a").unwrap_or(hsla(0., 0., 0.2, 1.)), + ghost_element_disabled: try_parse_color("#21252b") + .unwrap_or(hsla(0., 0., 0.15, 1.)), + text: try_parse_color("#aab2bf").unwrap_or(hsla(0., 0., 0.7, 1.)), + text_muted: try_parse_color("#5e6670").unwrap_or(hsla(0., 0., 0.4, 1.)), + text_placeholder: try_parse_color("#838994").unwrap_or(hsla(0., 0., 0.5, 1.)), + text_disabled: try_parse_color("#4c5360").unwrap_or(hsla(0., 0., 0.3, 1.)), + text_accent: try_parse_color("#5799e5").unwrap_or(hsla(0.6, 0.7, 0.6, 1.)), + icon: try_parse_color("#aab2bf").unwrap_or(hsla(0., 0., 0.7, 1.)), + icon_muted: try_parse_color("#5e6670").unwrap_or(hsla(0., 0., 0.4, 1.)), + icon_disabled: try_parse_color("#4c5360").unwrap_or(hsla(0., 0., 0.3, 1.)), + icon_placeholder: try_parse_color("#838994").unwrap_or(hsla(0., 0., 0.5, 1.)), + icon_accent: try_parse_color("#5799e5").unwrap_or(hsla(0.6, 0.7, 0.6, 1.)), + status_bar_background: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + title_bar_background: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + title_bar_inactive_background: try_parse_color("#282c34") + .unwrap_or(hsla(0., 0., 0.2, 1.)), + toolbar_background: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + tab_bar_background: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + tab_inactive_background: try_parse_color("#21252b") + .unwrap_or(hsla(0., 0., 0.15, 1.)), + tab_active_background: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + search_match_background: try_parse_color("#175fcc4d") + .unwrap_or(hsla(0.6, 0.8, 0.45, 0.3)), + panel_background: try_parse_color("#21252b").unwrap_or(hsla(0., 0., 0.15, 1.)), + panel_focused_border: try_parse_color("#2e60bc").unwrap_or(hsla(0.6, 0.7, 0.5, 1.)), + panel_indent_guide: try_parse_color("#2a2e36").unwrap_or(hsla(0., 0., 0.17, 1.)), + panel_indent_guide_hover: try_parse_color("#3a3f4b") + .unwrap_or(hsla(0., 0., 0.25, 1.)), + panel_indent_guide_active: try_parse_color("#4a515e") + .unwrap_or(hsla(0., 0., 0.32, 1.)), + pane_focused_border: try_parse_color("#2e60bc").unwrap_or(hsla(0.6, 0.7, 0.5, 1.)), + pane_group_border: try_parse_color("#181a1f").unwrap_or(hsla(0., 0., 0.1, 1.)), + scrollbar_thumb_background: try_parse_color("#F000F03d") + .unwrap_or(hsla(0., 1., 0.47, 0.24)), + scrollbar_thumb_hover_background: try_parse_color("#F000F052") + .unwrap_or(hsla(0., 1., 0.47, 0.32)), + scrollbar_thumb_active_background: try_parse_color("#F000F075") + .unwrap_or(hsla(0., 1., 0.47, 0.46)), + scrollbar_thumb_border: try_parse_color("#2a2e36") + .unwrap_or(hsla(0., 0., 0.17, 1.)), + scrollbar_track_background: hsla(0., 0., 0., 0.), + scrollbar_track_border: try_parse_color("#2a2d38") + .unwrap_or(hsla(0., 0., 0.18, 1.)), + minimap_thumb_background: try_parse_color("#4c526333") + .unwrap_or(hsla(0., 0., 0.35, 0.2)), + minimap_thumb_hover_background: try_parse_color("#4c52634d") + .unwrap_or(hsla(0., 0., 0.35, 0.3)), + minimap_thumb_active_background: try_parse_color("#4c526366") + .unwrap_or(hsla(0., 0., 0.35, 0.4)), + minimap_thumb_border: try_parse_color("#2a2d38").unwrap_or(hsla(0., 0., 0.18, 1.)), + editor_foreground: try_parse_color("#abb2bf").unwrap_or(hsla(0., 0., 0.7, 1.)), + editor_background: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + editor_gutter_background: try_parse_color("#282c34") + .unwrap_or(hsla(0., 0., 0.2, 1.)), + editor_subheader_background: try_parse_color("#21252b") + .unwrap_or(hsla(0., 0., 0.15, 1.)), + editor_active_line_background: try_parse_color("#F0F0F00a") + .unwrap_or(hsla(0., 0., 0.94, 0.04)), + editor_highlighted_line_background: try_parse_color("#F0F0F00f") + .unwrap_or(hsla(0., 0., 0.94, 0.06)), + editor_debugger_active_line_background: try_parse_color("#7e6cca52") + .unwrap_or(hsla(0.71, 0.4, 0.6, 0.32)), + editor_line_number: try_parse_color("#636b78").unwrap_or(hsla(0., 0., 0.42, 1.)), + editor_active_line_number: try_parse_color("#abb2bf") + .unwrap_or(hsla(0., 0., 0.7, 1.)), + editor_hover_line_number: try_parse_color("#abb2bf") + .unwrap_or(hsla(0., 0., 0.7, 1.)), + editor_invisible: try_parse_color("#5e6670").unwrap_or(hsla(0., 0., 0.4, 1.)), + editor_wrap_guide: try_parse_color("#2a2e36").unwrap_or(hsla(0., 0., 0.17, 1.)), + editor_active_wrap_guide: try_parse_color("#3a3f4b") + .unwrap_or(hsla(0., 0., 0.25, 1.)), + editor_indent_guide: try_parse_color("#2a2e36").unwrap_or(hsla(0., 0., 0.17, 1.)), + editor_indent_guide_active: try_parse_color("#3a3f4b") + .unwrap_or(hsla(0., 0., 0.25, 1.)), + editor_document_highlight_read_background: try_parse_color("#4370c40f") + .unwrap_or(hsla(0.6, 0.6, 0.6, 0.06)), + editor_document_highlight_write_background: try_parse_color("#4370c466") + .unwrap_or(hsla(0.6, 0.6, 0.6, 0.4)), + terminal_background: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + terminal_foreground: try_parse_color("#abb2bf").unwrap_or(hsla(0., 0., 0.7, 1.)), + terminal_bright_foreground: try_parse_color("#c8ccd4") + .unwrap_or(hsla(0., 0., 0.8, 1.)), + terminal_dim_foreground: try_parse_color("#5f697a") + .unwrap_or(hsla(0., 0., 0.4, 1.)), + terminal_ansi_black: try_parse_color("#282c34").unwrap_or(hsla(0., 0., 0.2, 1.)), + terminal_ansi_bright_black: try_parse_color("#3f4451") + .unwrap_or(hsla(0., 0., 0.27, 1.)), + terminal_ansi_dim_black: try_parse_color("#5f697a") + .unwrap_or(hsla(0., 0., 0.4, 1.)), + terminal_ansi_red: try_parse_color("#e06c75").unwrap_or(hsla(0.97, 0.65, 0.65, 1.)), + terminal_ansi_bright_red: try_parse_color("#d07277") + .unwrap_or(hsla(0.97, 0.55, 0.65, 1.)), + terminal_ansi_dim_red: try_parse_color("#c45660") + .unwrap_or(hsla(0.97, 0.5, 0.57, 1.)), + terminal_ansi_green: try_parse_color("#98c379").unwrap_or(hsla(0.3, 0.4, 0.6, 1.)), + terminal_ansi_bright_green: try_parse_color("#a9d88d") + .unwrap_or(hsla(0.3, 0.5, 0.7, 1.)), + terminal_ansi_dim_green: try_parse_color("#76a85d") + .unwrap_or(hsla(0.3, 0.3, 0.5, 1.)), + terminal_ansi_yellow: try_parse_color("#e5c07b") + .unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + terminal_ansi_bright_yellow: try_parse_color("#f0d197") + .unwrap_or(hsla(0.11, 0.7, 0.77, 1.)), + terminal_ansi_dim_yellow: try_parse_color("#d7a55f") + .unwrap_or(hsla(0.11, 0.6, 0.6, 1.)), + terminal_ansi_blue: try_parse_color("#61afef") + .unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + terminal_ansi_bright_blue: try_parse_color("#6cb3ff") + .unwrap_or(hsla(0.58, 1., 0.71, 1.)), + terminal_ansi_dim_blue: try_parse_color("#3d8fd4") + .unwrap_or(hsla(0.58, 0.7, 0.54, 1.)), + terminal_ansi_magenta: try_parse_color("#c678dd") + .unwrap_or(hsla(0.78, 0.6, 0.69, 1.)), + terminal_ansi_bright_magenta: try_parse_color("#ca82e5") + .unwrap_or(hsla(0.78, 0.7, 0.7, 1.)), + terminal_ansi_dim_magenta: try_parse_color("#a65cc8") + .unwrap_or(hsla(0.78, 0.5, 0.6, 1.)), + terminal_ansi_cyan: try_parse_color("#56b6c2").unwrap_or(hsla(0.53, 0.5, 0.56, 1.)), + terminal_ansi_bright_cyan: try_parse_color("#64c5d3") + .unwrap_or(hsla(0.53, 0.6, 0.61, 1.)), + terminal_ansi_dim_cyan: try_parse_color("#4096a1") + .unwrap_or(hsla(0.53, 0.42, 0.44, 1.)), + terminal_ansi_white: try_parse_color("#dcdfe4").unwrap_or(hsla(0., 0., 0.87, 1.)), + terminal_ansi_bright_white: try_parse_color("#f0f0f0") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + terminal_ansi_dim_white: try_parse_color("#abb2bf") + .unwrap_or(hsla(0., 0., 0.7, 1.)), + link_text_hover: try_parse_color("#5799e5").unwrap_or(hsla(0.6, 0.7, 0.6, 1.)), + version_control_added: ADDED_COLOR, + version_control_modified: MODIFIED_COLOR, + version_control_deleted: REMOVED_COLOR, + version_control_conflict_marker_ours: try_parse_color("#98c379") + .unwrap_or(hsla(0.3, 0.4, 0.6, 1.)), + version_control_conflict_marker_theirs: try_parse_color("#61afef") + .unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + debugger_accent: try_parse_color("#c678dd").unwrap_or(hsla(0.78, 0.6, 0.69, 1.)), + editor_document_highlight_bracket_background: try_parse_color("#4370c419") + .unwrap_or(hsla(0.6, 0.6, 0.6, 0.1)), + terminal_ansi_background: try_parse_color("#282c34") + .unwrap_or(hsla(0., 0., 0.2, 1.)), + version_control_renamed: try_parse_color("#61afef") + .unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + version_control_conflict: try_parse_color("#e5c07b") + .unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + version_control_ignored: try_parse_color("#5e6670") + .unwrap_or(hsla(0., 0., 0.4, 1.)), + }, + status: StatusColors { + conflict: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + conflict_background: try_parse_color("#332412") + .unwrap_or(hsla(0.11, 0.5, 0.14, 1.)), + conflict_border: try_parse_color("#5d4224").unwrap_or(hsla(0.11, 0.5, 0.25, 1.)), + created: try_parse_color("#98c379").unwrap_or(hsla(0.3, 0.4, 0.6, 1.)), + created_background: try_parse_color("#252d1f").unwrap_or(hsla(0.3, 0.2, 0.15, 1.)), + created_border: try_parse_color("#436330").unwrap_or(hsla(0.3, 0.35, 0.3, 1.)), + deleted: try_parse_color("#e06c75").unwrap_or(hsla(0.97, 0.65, 0.65, 1.)), + deleted_background: try_parse_color("#301c1e") + .unwrap_or(hsla(0.97, 0.25, 0.15, 1.)), + deleted_border: try_parse_color("#5e3135").unwrap_or(hsla(0.97, 0.3, 0.28, 1.)), + error: try_parse_color("#e06c75").unwrap_or(hsla(0.97, 0.65, 0.65, 1.)), + error_background: try_parse_color("#301c1e").unwrap_or(hsla(0.97, 0.25, 0.15, 1.)), + error_border: try_parse_color("#5e3135").unwrap_or(hsla(0.97, 0.3, 0.28, 1.)), + hidden: try_parse_color("#838994").unwrap_or(hsla(0., 0., 0.5, 1.)), + hidden_background: try_parse_color("#23252a").unwrap_or(hsla(0., 0., 0.15, 1.)), + hidden_border: try_parse_color("#3f4248").unwrap_or(hsla(0., 0., 0.26, 1.)), + hint: try_parse_color("#969dad").unwrap_or(hsla(0., 0., 0.6, 1.)), + hint_background: try_parse_color("#212843").unwrap_or(hsla(0.64, 0.34, 0.2, 1.)), + hint_border: try_parse_color("#3d4466").unwrap_or(hsla(0.64, 0.24, 0.32, 1.)), + ignored: try_parse_color("#838994").unwrap_or(hsla(0., 0., 0.5, 1.)), + ignored_background: try_parse_color("#23252a").unwrap_or(hsla(0., 0., 0.15, 1.)), + ignored_border: try_parse_color("#3f4248").unwrap_or(hsla(0., 0., 0.26, 1.)), + info: try_parse_color("#61afef").unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + info_background: try_parse_color("#1a2939").unwrap_or(hsla(0.58, 0.35, 0.17, 1.)), + info_border: try_parse_color("#274d75").unwrap_or(hsla(0.58, 0.5, 0.31, 1.)), + modified: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + modified_background: try_parse_color("#332412") + .unwrap_or(hsla(0.11, 0.5, 0.14, 1.)), + modified_border: try_parse_color("#5d4224").unwrap_or(hsla(0.11, 0.5, 0.25, 1.)), + predictive: try_parse_color("#808491").unwrap_or(hsla(0., 0., 0.55, 1.)), + predictive_background: try_parse_color("#222326").unwrap_or(hsla(0., 0., 0.14, 1.)), + predictive_border: try_parse_color("#3c3e45").unwrap_or(hsla(0., 0., 0.26, 1.)), + renamed: try_parse_color("#61afef").unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + renamed_background: try_parse_color("#1a2939") + .unwrap_or(hsla(0.58, 0.35, 0.17, 1.)), + renamed_border: try_parse_color("#274d75").unwrap_or(hsla(0.58, 0.5, 0.31, 1.)), + success: try_parse_color("#98c379").unwrap_or(hsla(0.3, 0.4, 0.6, 1.)), + success_background: try_parse_color("#252d1f").unwrap_or(hsla(0.3, 0.2, 0.15, 1.)), + success_border: try_parse_color("#436330").unwrap_or(hsla(0.3, 0.35, 0.3, 1.)), + unreachable: try_parse_color("#838994").unwrap_or(hsla(0., 0., 0.5, 1.)), + unreachable_background: try_parse_color("#23252a") + .unwrap_or(hsla(0., 0., 0.15, 1.)), + unreachable_border: try_parse_color("#3f4248").unwrap_or(hsla(0., 0., 0.26, 1.)), + warning: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + warning_background: try_parse_color("#332412").unwrap_or(hsla(0.11, 0.5, 0.14, 1.)), + warning_border: try_parse_color("#5d4224").unwrap_or(hsla(0.11, 0.5, 0.25, 1.)), + }, + player: PlayerColors(vec![ + PlayerColor { + cursor: try_parse_color("#61afef").unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + background: try_parse_color("#61afef").unwrap_or(hsla(0.58, 0.81, 0.68, 1.)), + selection: try_parse_color("#61afef3d").unwrap_or(hsla(0.58, 0.81, 0.68, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#a86fe8").unwrap_or(hsla(0.75, 0.75, 0.68, 1.)), + background: try_parse_color("#a86fe8").unwrap_or(hsla(0.75, 0.75, 0.68, 1.)), + selection: try_parse_color("#a86fe83d").unwrap_or(hsla(0.75, 0.75, 0.68, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#50d699").unwrap_or(hsla(0.42, 0.6, 0.59, 1.)), + background: try_parse_color("#50d699").unwrap_or(hsla(0.42, 0.6, 0.59, 1.)), + selection: try_parse_color("#50d6993d").unwrap_or(hsla(0.42, 0.6, 0.59, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#f35955").unwrap_or(hsla(0.005, 0.87, 0.65, 1.)), + background: try_parse_color("#f35955").unwrap_or(hsla(0.005, 0.87, 0.65, 1.)), + selection: try_parse_color("#f359553d") + .unwrap_or(hsla(0.005, 0.87, 0.65, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#fe9934").unwrap_or(hsla(0.08, 0.99, 0.6, 1.)), + background: try_parse_color("#fe9934").unwrap_or(hsla(0.08, 0.99, 0.6, 1.)), + selection: try_parse_color("#fe99343d").unwrap_or(hsla(0.08, 0.99, 0.6, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#ff69b4").unwrap_or(hsla(0.92, 1., 0.71, 1.)), + background: try_parse_color("#ff69b4").unwrap_or(hsla(0.92, 1., 0.71, 1.)), + selection: try_parse_color("#ff69b43d").unwrap_or(hsla(0.92, 1., 0.71, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#00bfff").unwrap_or(hsla(0.55, 1., 0.5, 1.)), + background: try_parse_color("#00bfff").unwrap_or(hsla(0.55, 1., 0.5, 1.)), + selection: try_parse_color("#00bfff3d").unwrap_or(hsla(0.55, 1., 0.5, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#00ff00").unwrap_or(hsla(0.33, 1., 0.5, 1.)), + background: try_parse_color("#00ff00").unwrap_or(hsla(0.33, 1., 0.5, 1.)), + selection: try_parse_color("#00ff003d").unwrap_or(hsla(0.33, 1., 0.5, 0.24)), + }, + ]), + syntax: Arc::new(SyntaxTheme { + highlights: vec![ + ( + "attribute".to_string(), + HighlightStyle { + color: try_parse_color("#e5c07b") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.67, 0.67, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "boolean".to_string(), + HighlightStyle { + color: try_parse_color("#d19a66") + .map(Some) + .unwrap_or(Some(hsla(0.08, 0.45, 0.61, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "comment".to_string(), + HighlightStyle { + color: try_parse_color("#6f7380") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.45, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "comment.doc".to_string(), + HighlightStyle { + color: try_parse_color("#848896") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.53, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "constant".to_string(), + HighlightStyle { + color: try_parse_color("#d19a66") + .map(Some) + .unwrap_or(Some(hsla(0.08, 0.45, 0.61, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "constructor".to_string(), + HighlightStyle { + color: try_parse_color("#61afef") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.81, 0.68, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "emphasis".to_string(), + HighlightStyle { + color: try_parse_color("#5799e5") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.7, 0.6, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "emphasis.strong".to_string(), + HighlightStyle { + color: try_parse_color("#5799e5") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.7, 0.6, 1.))), + font_style: None, + font_weight: Some(gpui::FontWeight::BOLD), + ..Default::default() + }, + ), + ( + "function".to_string(), + HighlightStyle { + color: try_parse_color("#61afef") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.81, 0.68, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "keyword".to_string(), + HighlightStyle { + color: try_parse_color("#c678dd") + .map(Some) + .unwrap_or(Some(hsla(0.78, 0.6, 0.69, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "label".to_string(), + HighlightStyle { + color: try_parse_color("#61afef") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.81, 0.68, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "link_text".to_string(), + HighlightStyle { + color: try_parse_color("#93c1e8") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.65, 0.74, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "link_uri".to_string(), + HighlightStyle { + color: try_parse_color("#56b6c2") + .map(Some) + .unwrap_or(Some(hsla(0.53, 0.5, 0.56, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "number".to_string(), + HighlightStyle { + color: try_parse_color("#d19a66") + .map(Some) + .unwrap_or(Some(hsla(0.08, 0.45, 0.61, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "operator".to_string(), + HighlightStyle { + color: try_parse_color("#56b6c2") + .map(Some) + .unwrap_or(Some(hsla(0.53, 0.5, 0.56, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "preproc".to_string(), + HighlightStyle { + color: try_parse_color("#c678dd") + .map(Some) + .unwrap_or(Some(hsla(0.78, 0.6, 0.69, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "property".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation".to_string(), + HighlightStyle { + color: try_parse_color("#abb2bf") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.7, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.bracket".to_string(), + HighlightStyle { + color: try_parse_color("#abb2bf") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.7, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.delimiter".to_string(), + HighlightStyle { + color: try_parse_color("#abb2bf") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.7, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.list_marker".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.special".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string".to_string(), + HighlightStyle { + color: try_parse_color("#98c379") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.4, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.escape".to_string(), + HighlightStyle { + color: try_parse_color("#56b6c2") + .map(Some) + .unwrap_or(Some(hsla(0.53, 0.5, 0.56, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.regex".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.special".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.special.symbol".to_string(), + HighlightStyle { + color: try_parse_color("#98c379") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.4, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "tag".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "text.literal".to_string(), + HighlightStyle { + color: try_parse_color("#98c379") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.4, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "title".to_string(), + HighlightStyle { + color: try_parse_color("#61afef") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.81, 0.68, 1.))), + font_style: None, + font_weight: Some(gpui::FontWeight::BOLD), + ..Default::default() + }, + ), + ( + "type".to_string(), + HighlightStyle { + color: try_parse_color("#e5c07b") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.67, 0.67, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variable".to_string(), + HighlightStyle { + color: try_parse_color("#e06c75") + .map(Some) + .unwrap_or(Some(hsla(0.97, 0.65, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variable.special".to_string(), + HighlightStyle { + color: try_parse_color("#c678dd") + .map(Some) + .unwrap_or(Some(hsla(0.78, 0.6, 0.69, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variant".to_string(), + HighlightStyle { + color: try_parse_color("#61afef") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.81, 0.68, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ], + }), + }, + } +} + +pub fn default_light_theme() -> Theme { + Theme { + id: "one-light".to_string(), + name: "One Light".into(), + appearance: Appearance::Light, + styles: ThemeStyles { + window_background_appearance: WindowBackgroundAppearance::Opaque, + system: SystemColors::default(), + // todo! fill out correct colors + accents: AccentColors(vec![try_parse_color("red").unwrap_or(hsla(0., 0., 0., 0.))]), + colors: ThemeColors { + border: try_parse_color("#d9dce0").unwrap_or(hsla(0., 0., 0.86, 1.)), + border_variant: try_parse_color("#d9dce0").unwrap_or(hsla(0., 0., 0.86, 1.)), + border_focused: try_parse_color("#2188ff").unwrap_or(hsla(0.58, 1., 0.57, 1.)), + border_selected: try_parse_color("#4198ff").unwrap_or(hsla(0.58, 1., 0.63, 1.)), + border_transparent: hsla(0., 0., 0., 0.), + border_disabled: try_parse_color("#c9cbd1").unwrap_or(hsla(0., 0., 0.79, 1.)), + elevated_surface_background: try_parse_color("#e0e1e6") + .unwrap_or(hsla(0., 0., 0.88, 1.)), + surface_background: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + background: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + element_background: try_parse_color("#e0e1e6").unwrap_or(hsla(0., 0., 0.88, 1.)), + element_hover: try_parse_color("#e0e1e680").unwrap_or(hsla(0., 0., 0.88, 0.5)), + element_active: try_parse_color("#e0e1e620").unwrap_or(hsla(0., 0., 0.88, 0.125)), + element_selected: try_parse_color("#e0e1e6").unwrap_or(hsla(0., 0., 0.88, 1.)), + element_selection_background: try_parse_color("#4198ff3d") + .unwrap_or(hsla(0.58, 1., 0.63, 0.24)), + element_disabled: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + drop_target_background: try_parse_color("#FF00FF7F") + .unwrap_or(hsla(0.83, 1., 0.5, 0.5)), + ghost_element_background: hsla(0., 0., 0., 0.), + ghost_element_hover: try_parse_color("#e0e1e680") + .unwrap_or(hsla(0., 0., 0.88, 0.5)), + ghost_element_active: try_parse_color("#e0e1e620") + .unwrap_or(hsla(0., 0., 0.88, 0.125)), + ghost_element_selected: try_parse_color("#e0e1e6") + .unwrap_or(hsla(0., 0., 0.88, 1.)), + ghost_element_disabled: try_parse_color("#f0f0f1") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + text: try_parse_color("#383a42").unwrap_or(hsla(0., 0., 0.24, 1.)), + text_muted: try_parse_color("#a2a3a7").unwrap_or(hsla(0., 0., 0.64, 1.)), + text_placeholder: try_parse_color("#898b92").unwrap_or(hsla(0., 0., 0.55, 1.)), + text_disabled: try_parse_color("#a8abb3").unwrap_or(hsla(0., 0., 0.67, 1.)), + text_accent: try_parse_color("#0d74f0").unwrap_or(hsla(0.58, 0.9, 0.5, 1.)), + icon: try_parse_color("#383a42").unwrap_or(hsla(0., 0., 0.24, 1.)), + icon_muted: try_parse_color("#7f848e").unwrap_or(hsla(0., 0., 0.52, 1.)), + icon_disabled: try_parse_color("#a8abb3").unwrap_or(hsla(0., 0., 0.67, 1.)), + icon_placeholder: try_parse_color("#898b92").unwrap_or(hsla(0., 0., 0.55, 1.)), + icon_accent: try_parse_color("#0d74f0").unwrap_or(hsla(0.58, 0.9, 0.5, 1.)), + status_bar_background: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + title_bar_background: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + title_bar_inactive_background: try_parse_color("#fafafa") + .unwrap_or(hsla(0., 0., 0.98, 1.)), + toolbar_background: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + tab_bar_background: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + tab_inactive_background: try_parse_color("#f0f0f1") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + tab_active_background: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + search_match_background: try_parse_color("#175fcc4d") + .unwrap_or(hsla(0.58, 0.8, 0.45, 0.3)), + panel_background: try_parse_color("#f0f0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + panel_focused_border: try_parse_color("#2188ff") + .unwrap_or(hsla(0.58, 1., 0.57, 1.)), + panel_indent_guide: try_parse_color("#e0e1e6").unwrap_or(hsla(0., 0., 0.88, 1.)), + panel_indent_guide_hover: try_parse_color("#c9cbd1") + .unwrap_or(hsla(0., 0., 0.79, 1.)), + panel_indent_guide_active: try_parse_color("#b2b5bd") + .unwrap_or(hsla(0., 0., 0.71, 1.)), + pane_focused_border: try_parse_color("#2188ff").unwrap_or(hsla(0.58, 1., 0.57, 1.)), + pane_group_border: try_parse_color("#d9dce0").unwrap_or(hsla(0., 0., 0.86, 1.)), + scrollbar_thumb_background: try_parse_color("#F000F03d") + .unwrap_or(hsla(0., 1., 0.47, 0.24)), + scrollbar_thumb_hover_background: try_parse_color("#F000F052") + .unwrap_or(hsla(0., 1., 0.47, 0.32)), + scrollbar_thumb_active_background: try_parse_color("#F000F075") + .unwrap_or(hsla(0., 1., 0.47, 0.46)), + scrollbar_thumb_border: try_parse_color("#e0e1e6") + .unwrap_or(hsla(0., 0., 0.88, 1.)), + scrollbar_track_background: hsla(0., 0., 0., 0.), + scrollbar_track_border: try_parse_color("#eff0f1") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + minimap_thumb_background: try_parse_color("#b2b5bd33") + .unwrap_or(hsla(0., 0., 0.71, 0.2)), + minimap_thumb_hover_background: try_parse_color("#b2b5bd4d") + .unwrap_or(hsla(0., 0., 0.71, 0.3)), + minimap_thumb_active_background: try_parse_color("#b2b5bd66") + .unwrap_or(hsla(0., 0., 0.71, 0.4)), + minimap_thumb_border: try_parse_color("#eff0f1").unwrap_or(hsla(0., 0., 0.94, 1.)), + editor_foreground: try_parse_color("#383a42").unwrap_or(hsla(0., 0., 0.24, 1.)), + editor_background: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + editor_gutter_background: try_parse_color("#fafafa") + .unwrap_or(hsla(0., 0., 0.98, 1.)), + editor_subheader_background: try_parse_color("#f0f0f1") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + editor_active_line_background: try_parse_color("#F0F0F00a") + .unwrap_or(hsla(0., 0., 0.94, 0.04)), + editor_highlighted_line_background: try_parse_color("#F0F0F00f") + .unwrap_or(hsla(0., 0., 0.94, 0.06)), + editor_debugger_active_line_background: try_parse_color("#7e6cca52") + .unwrap_or(hsla(0.71, 0.4, 0.6, 0.32)), + editor_line_number: try_parse_color("#9fa2a6").unwrap_or(hsla(0., 0., 0.63, 1.)), + editor_active_line_number: try_parse_color("#383a42") + .unwrap_or(hsla(0., 0., 0.24, 1.)), + editor_hover_line_number: try_parse_color("#383a42") + .unwrap_or(hsla(0., 0., 0.24, 1.)), + editor_invisible: try_parse_color("#a2a3a7").unwrap_or(hsla(0., 0., 0.64, 1.)), + editor_wrap_guide: try_parse_color("#e0e1e6").unwrap_or(hsla(0., 0., 0.88, 1.)), + editor_active_wrap_guide: try_parse_color("#c9cbd1") + .unwrap_or(hsla(0., 0., 0.79, 1.)), + editor_indent_guide: try_parse_color("#e0e1e6").unwrap_or(hsla(0., 0., 0.88, 1.)), + editor_indent_guide_active: try_parse_color("#c9cbd1") + .unwrap_or(hsla(0., 0., 0.79, 1.)), + editor_document_highlight_read_background: try_parse_color("#4198ff0f") + .unwrap_or(hsla(0.58, 1., 0.63, 0.06)), + editor_document_highlight_write_background: try_parse_color("#4198ff66") + .unwrap_or(hsla(0.58, 1., 0.63, 0.4)), + terminal_background: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + terminal_foreground: try_parse_color("#383a42").unwrap_or(hsla(0., 0., 0.24, 1.)), + terminal_bright_foreground: try_parse_color("#2f313a") + .unwrap_or(hsla(0., 0., 0.21, 1.)), + terminal_dim_foreground: try_parse_color("#7e7f83") + .unwrap_or(hsla(0., 0., 0.5, 1.)), + terminal_ansi_black: try_parse_color("#fafafa").unwrap_or(hsla(0., 0., 0.98, 1.)), + terminal_ansi_bright_black: try_parse_color("#d8d9db") + .unwrap_or(hsla(0., 0., 0.85, 1.)), + terminal_ansi_dim_black: try_parse_color("#7e7f83") + .unwrap_or(hsla(0., 0., 0.5, 1.)), + terminal_ansi_red: try_parse_color("#e45649").unwrap_or(hsla(0.01, 0.74, 0.59, 1.)), + terminal_ansi_bright_red: try_parse_color("#ca695a") + .unwrap_or(hsla(0.02, 0.54, 0.58, 1.)), + terminal_ansi_dim_red: try_parse_color("#c24941") + .unwrap_or(hsla(0.01, 0.5, 0.5, 1.)), + terminal_ansi_green: try_parse_color("#50a14f") + .unwrap_or(hsla(0.33, 0.34, 0.47, 1.)), + terminal_ansi_bright_green: try_parse_color("#6db164") + .unwrap_or(hsla(0.35, 0.42, 0.55, 1.)), + terminal_ansi_dim_green: try_parse_color("#418141") + .unwrap_or(hsla(0.33, 0.33, 0.38, 1.)), + terminal_ansi_yellow: try_parse_color("#c18401") + .unwrap_or(hsla(0.11, 0.99, 0.38, 1.)), + terminal_ansi_bright_yellow: try_parse_color("#d49c3d") + .unwrap_or(hsla(0.11, 0.67, 0.53, 1.)), + terminal_ansi_dim_yellow: try_parse_color("#9e6a01") + .unwrap_or(hsla(0.11, 0.99, 0.31, 1.)), + terminal_ansi_blue: try_parse_color("#4078f2").unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + terminal_ansi_bright_blue: try_parse_color("#5085ce") + .unwrap_or(hsla(0.6, 0.6, 0.56, 1.)), + terminal_ansi_dim_blue: try_parse_color("#2d60c8") + .unwrap_or(hsla(0.6, 0.65, 0.48, 1.)), + terminal_ansi_magenta: try_parse_color("#a626a4") + .unwrap_or(hsla(0.83, 0.61, 0.4, 1.)), + terminal_ansi_bright_magenta: try_parse_color("#a84db2") + .unwrap_or(hsla(0.82, 0.42, 0.49, 1.)), + terminal_ansi_dim_magenta: try_parse_color("#841e83") + .unwrap_or(hsla(0.83, 0.64, 0.32, 1.)), + terminal_ansi_cyan: try_parse_color("#0184bc") + .unwrap_or(hsla(0.55, 0.99, 0.37, 1.)), + terminal_ansi_bright_cyan: try_parse_color("#4394c7") + .unwrap_or(hsla(0.55, 0.5, 0.52, 1.)), + terminal_ansi_dim_cyan: try_parse_color("#006a97") + .unwrap_or(hsla(0.55, 1., 0.29, 1.)), + terminal_ansi_white: try_parse_color("#1e2127").unwrap_or(hsla(0., 0., 0.13, 1.)), + terminal_ansi_bright_white: try_parse_color("#F0F0F0") + .unwrap_or(hsla(0., 0., 0.94, 1.)), + terminal_ansi_dim_white: try_parse_color("#383a42") + .unwrap_or(hsla(0., 0., 0.24, 1.)), + link_text_hover: try_parse_color("#0d74f0").unwrap_or(hsla(0.58, 0.9, 0.5, 1.)), + version_control_added: ADDED_COLOR, + version_control_modified: MODIFIED_COLOR, + version_control_deleted: REMOVED_COLOR, + version_control_conflict_marker_ours: try_parse_color("#50a14f") + .unwrap_or(hsla(0.3, 0.34, 0.47, 1.)), + version_control_conflict_marker_theirs: try_parse_color("#4078f2") + .unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + debugger_accent: try_parse_color("#a626a4").unwrap_or(hsla(0.83, 0.61, 0.4, 1.)), + editor_document_highlight_bracket_background: try_parse_color("#4198ff19") + .unwrap_or(hsla(0.58, 1., 0.63, 0.1)), + terminal_ansi_background: try_parse_color("#fafafa") + .unwrap_or(hsla(0., 0., 0.98, 1.)), + version_control_renamed: try_parse_color("#4078f2") + .unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + version_control_conflict: try_parse_color("#c18401") + .unwrap_or(hsla(0.11, 0.99, 0.38, 1.)), + version_control_ignored: try_parse_color("#a2a3a7") + .unwrap_or(hsla(0., 0., 0.64, 1.)), + }, + status: StatusColors { + conflict: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + conflict_background: try_parse_color("#f2eeda") + .unwrap_or(hsla(0.11, 0.5, 0.91, 1.)), + conflict_border: try_parse_color("#e2d5b1").unwrap_or(hsla(0.11, 0.5, 0.78, 1.)), + created: try_parse_color("#50a14f").unwrap_or(hsla(0.3, 0.34, 0.47, 1.)), + created_background: try_parse_color("#e1eee1").unwrap_or(hsla(0.33, 0.23, 0.9, 1.)), + created_border: try_parse_color("#b7d4b7").unwrap_or(hsla(0.33, 0.29, 0.75, 1.)), + deleted: try_parse_color("#e45649").unwrap_or(hsla(0.01, 0.74, 0.59, 1.)), + deleted_background: try_parse_color("#fae0dd").unwrap_or(hsla(0.01, 0.7, 0.92, 1.)), + deleted_border: try_parse_color("#ecb8b2").unwrap_or(hsla(0.01, 0.6, 0.83, 1.)), + error: try_parse_color("#e45649").unwrap_or(hsla(0.01, 0.74, 0.59, 1.)), + error_background: try_parse_color("#fae0dd").unwrap_or(hsla(0.01, 0.7, 0.92, 1.)), + error_border: try_parse_color("#ecb8b2").unwrap_or(hsla(0.01, 0.6, 0.83, 1.)), + hidden: try_parse_color("#898b92").unwrap_or(hsla(0., 0., 0.55, 1.)), + hidden_background: try_parse_color("#f4f4f5").unwrap_or(hsla(0., 0., 0.96, 1.)), + hidden_border: try_parse_color("#e1e2e5").unwrap_or(hsla(0., 0., 0.89, 1.)), + hint: try_parse_color("#6b6d76").unwrap_or(hsla(0., 0., 0.44, 1.)), + hint_background: try_parse_color("#e8e8ed").unwrap_or(hsla(0.64, 0.15, 0.91, 1.)), + hint_border: try_parse_color("#c8c9d5").unwrap_or(hsla(0.64, 0.18, 0.81, 1.)), + ignored: try_parse_color("#898b92").unwrap_or(hsla(0., 0., 0.55, 1.)), + ignored_background: try_parse_color("#f4f4f5").unwrap_or(hsla(0., 0., 0.96, 1.)), + ignored_border: try_parse_color("#e1e2e5").unwrap_or(hsla(0., 0., 0.89, 1.)), + info: try_parse_color("#4078f2").unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + info_background: try_parse_color("#d9e4fa").unwrap_or(hsla(0.6, 0.75, 0.92, 1.)), + info_border: try_parse_color("#a9c0ea").unwrap_or(hsla(0.6, 0.55, 0.77, 1.)), + modified: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + modified_background: try_parse_color("#f2eeda") + .unwrap_or(hsla(0.11, 0.5, 0.91, 1.)), + modified_border: try_parse_color("#e2d5b1").unwrap_or(hsla(0.11, 0.5, 0.78, 1.)), + predictive: try_parse_color("#969799").unwrap_or(hsla(0., 0., 0.59, 1.)), + predictive_background: try_parse_color("#f5f5f5").unwrap_or(hsla(0., 0., 0.96, 1.)), + predictive_border: try_parse_color("#e4e4e5").unwrap_or(hsla(0., 0., 0.89, 1.)), + renamed: try_parse_color("#4078f2").unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + renamed_background: try_parse_color("#d9e4fa").unwrap_or(hsla(0.6, 0.75, 0.92, 1.)), + renamed_border: try_parse_color("#a9c0ea").unwrap_or(hsla(0.6, 0.55, 0.77, 1.)), + success: try_parse_color("#50a14f").unwrap_or(hsla(0.3, 0.34, 0.47, 1.)), + success_background: try_parse_color("#e1eee1").unwrap_or(hsla(0.33, 0.23, 0.9, 1.)), + success_border: try_parse_color("#b7d4b7").unwrap_or(hsla(0.33, 0.29, 0.75, 1.)), + unreachable: try_parse_color("#898b92").unwrap_or(hsla(0., 0., 0.55, 1.)), + unreachable_background: try_parse_color("#f4f4f5") + .unwrap_or(hsla(0., 0., 0.96, 1.)), + unreachable_border: try_parse_color("#e1e2e5").unwrap_or(hsla(0., 0., 0.89, 1.)), + warning: try_parse_color("#e5c07b").unwrap_or(hsla(0.11, 0.67, 0.67, 1.)), + warning_background: try_parse_color("#f2eeda").unwrap_or(hsla(0.11, 0.5, 0.91, 1.)), + warning_border: try_parse_color("#e2d5b1").unwrap_or(hsla(0.11, 0.5, 0.78, 1.)), + }, + player: PlayerColors(vec![ + PlayerColor { + cursor: try_parse_color("#4078f2").unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + background: try_parse_color("#4078f2").unwrap_or(hsla(0.6, 0.88, 0.6, 1.)), + selection: try_parse_color("#4078f23d").unwrap_or(hsla(0.6, 0.88, 0.6, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#994cc3").unwrap_or(hsla(0.77, 0.5, 0.53, 1.)), + background: try_parse_color("#994cc3").unwrap_or(hsla(0.77, 0.5, 0.53, 1.)), + selection: try_parse_color("#994cc33d").unwrap_or(hsla(0.77, 0.5, 0.53, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#0aa579").unwrap_or(hsla(0.45, 0.9, 0.34, 1.)), + background: try_parse_color("#0aa579").unwrap_or(hsla(0.45, 0.9, 0.34, 1.)), + selection: try_parse_color("#0aa5793d").unwrap_or(hsla(0.45, 0.9, 0.34, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#d4333c").unwrap_or(hsla(0.98, 0.63, 0.52, 1.)), + background: try_parse_color("#d4333c").unwrap_or(hsla(0.98, 0.63, 0.52, 1.)), + selection: try_parse_color("#d4333c3d").unwrap_or(hsla(0.98, 0.63, 0.52, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#d46600").unwrap_or(hsla(0.08, 1., 0.42, 1.)), + background: try_parse_color("#d46600").unwrap_or(hsla(0.08, 1., 0.42, 1.)), + selection: try_parse_color("#d466003d").unwrap_or(hsla(0.08, 1., 0.42, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#ff69b4").unwrap_or(hsla(0.92, 1., 0.71, 1.)), + background: try_parse_color("#ff69b4").unwrap_or(hsla(0.92, 1., 0.71, 1.)), + selection: try_parse_color("#ff69b43d").unwrap_or(hsla(0.92, 1., 0.71, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#00a8cc").unwrap_or(hsla(0.54, 1., 0.4, 1.)), + background: try_parse_color("#00a8cc").unwrap_or(hsla(0.54, 1., 0.4, 1.)), + selection: try_parse_color("#00a8cc3d").unwrap_or(hsla(0.54, 1., 0.4, 0.24)), + }, + PlayerColor { + cursor: try_parse_color("#00ff00").unwrap_or(hsla(0.33, 1., 0.5, 1.)), + background: try_parse_color("#00ff00").unwrap_or(hsla(0.33, 1., 0.5, 1.)), + selection: try_parse_color("#00ff003d").unwrap_or(hsla(0.33, 1., 0.5, 0.24)), + }, + ]), + syntax: Arc::new(SyntaxTheme { + highlights: vec![ + ( + "attribute".to_string(), + HighlightStyle { + color: try_parse_color("#c18401") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.99, 0.38, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "boolean".to_string(), + HighlightStyle { + color: try_parse_color("#986801") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.99, 0.3, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "comment".to_string(), + HighlightStyle { + color: try_parse_color("#b0b2b6") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.7, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "comment.doc".to_string(), + HighlightStyle { + color: try_parse_color("#9b9da3") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.62, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "constant".to_string(), + HighlightStyle { + color: try_parse_color("#986801") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.99, 0.3, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "constructor".to_string(), + HighlightStyle { + color: try_parse_color("#4078f2") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.88, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "emphasis".to_string(), + HighlightStyle { + color: try_parse_color("#0d74f0") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.9, 0.5, 1.))), + font_style: Some(gpui::FontStyle::Italic), + font_weight: None, + ..Default::default() + }, + ), + ( + "emphasis.strong".to_string(), + HighlightStyle { + color: try_parse_color("#0d74f0") + .map(Some) + .unwrap_or(Some(hsla(0.58, 0.9, 0.5, 1.))), + font_style: None, + font_weight: Some(gpui::FontWeight::BOLD), + ..Default::default() + }, + ), + ( + "function".to_string(), + HighlightStyle { + color: try_parse_color("#4078f2") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.88, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "keyword".to_string(), + HighlightStyle { + color: try_parse_color("#a626a4") + .map(Some) + .unwrap_or(Some(hsla(0.83, 0.61, 0.4, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "label".to_string(), + HighlightStyle { + color: try_parse_color("#4078f2") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.88, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "link_text".to_string(), + HighlightStyle { + color: try_parse_color("#5685f5") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.9, 0.65, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "link_uri".to_string(), + HighlightStyle { + color: try_parse_color("#0184bc") + .map(Some) + .unwrap_or(Some(hsla(0.55, 0.99, 0.37, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "number".to_string(), + HighlightStyle { + color: try_parse_color("#986801") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.99, 0.3, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "operator".to_string(), + HighlightStyle { + color: try_parse_color("#0184bc") + .map(Some) + .unwrap_or(Some(hsla(0.55, 0.99, 0.37, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "preproc".to_string(), + HighlightStyle { + color: try_parse_color("#a626a4") + .map(Some) + .unwrap_or(Some(hsla(0.83, 0.61, 0.4, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "property".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation".to_string(), + HighlightStyle { + color: try_parse_color("#383a42") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.24, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.bracket".to_string(), + HighlightStyle { + color: try_parse_color("#383a42") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.24, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.delimiter".to_string(), + HighlightStyle { + color: try_parse_color("#383a42") + .map(Some) + .unwrap_or(Some(hsla(0., 0., 0.24, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.list_marker".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "punctuation.special".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string".to_string(), + HighlightStyle { + color: try_parse_color("#50a14f") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.34, 0.47, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.escape".to_string(), + HighlightStyle { + color: try_parse_color("#0184bc") + .map(Some) + .unwrap_or(Some(hsla(0.55, 0.99, 0.37, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.regex".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.special".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "string.special.symbol".to_string(), + HighlightStyle { + color: try_parse_color("#50a14f") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.34, 0.47, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "tag".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "text.literal".to_string(), + HighlightStyle { + color: try_parse_color("#50a14f") + .map(Some) + .unwrap_or(Some(hsla(0.3, 0.34, 0.47, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "title".to_string(), + HighlightStyle { + color: try_parse_color("#4078f2") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.88, 0.6, 1.))), + font_style: None, + font_weight: Some(gpui::FontWeight::BOLD), + ..Default::default() + }, + ), + ( + "type".to_string(), + HighlightStyle { + color: try_parse_color("#c18401") + .map(Some) + .unwrap_or(Some(hsla(0.11, 0.99, 0.38, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variable".to_string(), + HighlightStyle { + color: try_parse_color("#e45649") + .map(Some) + .unwrap_or(Some(hsla(0.01, 0.74, 0.59, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variable.special".to_string(), + HighlightStyle { + color: try_parse_color("#a626a4") + .map(Some) + .unwrap_or(Some(hsla(0.83, 0.61, 0.4, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ( + "variant".to_string(), + HighlightStyle { + color: try_parse_color("#4078f2") + .map(Some) + .unwrap_or(Some(hsla(0.6, 0.88, 0.6, 1.))), + font_style: None, + font_weight: None, + ..Default::default() + }, + ), + ], + }), + }, + } +} diff --git a/crates/theme/src/default_colors.rs b/crates/theme/src/default_colors.rs deleted file mode 100644 index 3424e0fe04cdbc11544fa81018edba4ff2b357c1..0000000000000000000000000000000000000000 --- a/crates/theme/src/default_colors.rs +++ /dev/null @@ -1,2462 +0,0 @@ -use gpui::{Hsla, Rgba}; - -use crate::ColorScale; -use crate::scale::{ColorScaleSet, ColorScales}; -use crate::{SystemColors, ThemeColors}; - -pub(crate) fn neutral() -> ColorScaleSet { - sand() -} - -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, -}; - -/// The default colors for the theme. -/// -/// Themes that do not specify all colors are refined off of these defaults. -impl ThemeColors { - /// Returns the default colors for light themes. - /// - /// Themes that do not specify all colors are refined off of these defaults. - pub fn light() -> Self { - let system = SystemColors::default(); - - Self { - border: neutral().light().step_6(), - border_variant: neutral().light().step_5(), - border_focused: blue().light().step_5(), - border_selected: blue().light().step_5(), - border_transparent: system.transparent, - border_disabled: neutral().light().step_3(), - elevated_surface_background: neutral().light().step_2(), - surface_background: neutral().light().step_2(), - background: neutral().light().step_1(), - element_background: neutral().light().step_3(), - element_hover: neutral().light_alpha().step_4(), - element_active: neutral().light_alpha().step_5(), - element_selected: neutral().light_alpha().step_5(), - element_disabled: neutral().light_alpha().step_3(), - element_selection_background: blue().light().step_3().alpha(0.25), - drop_target_background: blue().light_alpha().step_2(), - ghost_element_background: system.transparent, - ghost_element_hover: neutral().light_alpha().step_3(), - ghost_element_active: neutral().light_alpha().step_4(), - ghost_element_selected: neutral().light_alpha().step_5(), - ghost_element_disabled: neutral().light_alpha().step_3(), - text: neutral().light().step_12(), - text_muted: neutral().light().step_10(), - text_placeholder: neutral().light().step_10(), - text_disabled: neutral().light().step_9(), - text_accent: blue().light().step_11(), - icon: neutral().light().step_11(), - icon_muted: neutral().light().step_10(), - icon_disabled: neutral().light().step_9(), - icon_placeholder: neutral().light().step_10(), - icon_accent: blue().light().step_11(), - debugger_accent: red().light().step_10(), - status_bar_background: neutral().light().step_2(), - title_bar_background: neutral().light().step_2(), - title_bar_inactive_background: neutral().light().step_3(), - toolbar_background: neutral().light().step_1(), - tab_bar_background: neutral().light().step_2(), - tab_inactive_background: neutral().light().step_2(), - tab_active_background: neutral().light().step_1(), - search_match_background: neutral().light().step_5(), - panel_background: neutral().light().step_2(), - panel_focused_border: blue().light().step_10(), - panel_indent_guide: neutral().light_alpha().step_5(), - panel_indent_guide_hover: neutral().light_alpha().step_6(), - panel_indent_guide_active: neutral().light_alpha().step_6(), - pane_focused_border: blue().light().step_5(), - pane_group_border: neutral().light().step_6(), - scrollbar_thumb_background: neutral().light_alpha().step_3(), - scrollbar_thumb_hover_background: neutral().light_alpha().step_4(), - scrollbar_thumb_active_background: neutral().light_alpha().step_5(), - scrollbar_thumb_border: gpui::transparent_black(), - scrollbar_track_background: gpui::transparent_black(), - scrollbar_track_border: neutral().light().step_5(), - minimap_thumb_background: neutral().light_alpha().step_3().alpha(0.7), - minimap_thumb_hover_background: neutral().light_alpha().step_4().alpha(0.7), - minimap_thumb_active_background: neutral().light_alpha().step_5().alpha(0.7), - minimap_thumb_border: gpui::transparent_black(), - editor_foreground: neutral().light().step_12(), - editor_background: neutral().light().step_1(), - editor_gutter_background: neutral().light().step_1(), - editor_subheader_background: neutral().light().step_2(), - editor_active_line_background: neutral().light_alpha().step_3(), - editor_highlighted_line_background: neutral().light_alpha().step_3(), - editor_debugger_active_line_background: yellow().dark_alpha().step_3(), - editor_line_number: neutral().light().step_10(), - editor_hover_line_number: neutral().light().step_12(), - editor_active_line_number: neutral().light().step_11(), - editor_invisible: neutral().light().step_10(), - editor_wrap_guide: neutral().light_alpha().step_7(), - editor_active_wrap_guide: neutral().light_alpha().step_8(), - editor_indent_guide: neutral().light_alpha().step_5(), - editor_indent_guide_active: neutral().light_alpha().step_6(), - editor_document_highlight_read_background: neutral().light_alpha().step_3(), - editor_document_highlight_write_background: neutral().light_alpha().step_4(), - editor_document_highlight_bracket_background: green().light_alpha().step_5(), - terminal_background: neutral().light().step_1(), - terminal_foreground: black().light().step_12(), - terminal_bright_foreground: black().light().step_11(), - terminal_dim_foreground: black().light().step_10(), - terminal_ansi_background: neutral().light().step_1(), - terminal_ansi_bright_black: black().light().step_11(), - terminal_ansi_bright_red: red().light().step_10(), - terminal_ansi_bright_green: green().light().step_10(), - terminal_ansi_bright_yellow: yellow().light().step_10(), - terminal_ansi_bright_blue: blue().light().step_10(), - terminal_ansi_bright_magenta: violet().light().step_10(), - terminal_ansi_bright_cyan: cyan().light().step_10(), - terminal_ansi_bright_white: neutral().light().step_11(), - terminal_ansi_black: black().light().step_12(), - terminal_ansi_red: red().light().step_11(), - terminal_ansi_green: green().light().step_11(), - terminal_ansi_yellow: yellow().light().step_11(), - terminal_ansi_blue: blue().light().step_11(), - terminal_ansi_magenta: violet().light().step_11(), - terminal_ansi_cyan: cyan().light().step_11(), - terminal_ansi_white: neutral().light().step_12(), - terminal_ansi_dim_black: black().light().step_11(), - terminal_ansi_dim_red: red().light().step_10(), - terminal_ansi_dim_green: green().light().step_10(), - terminal_ansi_dim_yellow: yellow().light().step_10(), - terminal_ansi_dim_blue: blue().light().step_10(), - terminal_ansi_dim_magenta: violet().light().step_10(), - terminal_ansi_dim_cyan: cyan().light().step_10(), - terminal_ansi_dim_white: neutral().light().step_11(), - link_text_hover: orange().light().step_10(), - version_control_added: ADDED_COLOR, - version_control_deleted: REMOVED_COLOR, - version_control_modified: MODIFIED_COLOR, - version_control_renamed: MODIFIED_COLOR, - version_control_conflict: orange().light().step_12(), - version_control_ignored: gray().light().step_12(), - version_control_conflict_marker_ours: green().light().step_10().alpha(0.5), - version_control_conflict_marker_theirs: blue().light().step_10().alpha(0.5), - } - } - - /// Returns the default colors for dark themes. - /// - /// Themes that do not specify all colors are refined off of these defaults. - pub fn dark() -> Self { - let system = SystemColors::default(); - - Self { - border: neutral().dark().step_6(), - border_variant: neutral().dark().step_5(), - border_focused: blue().dark().step_5(), - border_selected: blue().dark().step_5(), - border_transparent: system.transparent, - border_disabled: neutral().dark().step_3(), - elevated_surface_background: neutral().dark().step_2(), - surface_background: neutral().dark().step_2(), - background: neutral().dark().step_1(), - element_background: neutral().dark().step_3(), - element_hover: neutral().dark_alpha().step_4(), - element_active: neutral().dark_alpha().step_5(), - element_selected: neutral().dark_alpha().step_5(), - element_disabled: neutral().dark_alpha().step_3(), - element_selection_background: blue().dark().step_3().alpha(0.25), - drop_target_background: blue().dark_alpha().step_2(), - ghost_element_background: system.transparent, - ghost_element_hover: neutral().dark_alpha().step_4(), - ghost_element_active: neutral().dark_alpha().step_5(), - ghost_element_selected: neutral().dark_alpha().step_5(), - ghost_element_disabled: neutral().dark_alpha().step_3(), - text: neutral().dark().step_12(), - text_muted: neutral().dark().step_11(), - text_placeholder: neutral().dark().step_10(), - text_disabled: neutral().dark().step_9(), - text_accent: blue().dark().step_11(), - icon: neutral().dark().step_11(), - icon_muted: neutral().dark().step_10(), - icon_disabled: neutral().dark().step_9(), - icon_placeholder: neutral().dark().step_10(), - icon_accent: blue().dark().step_11(), - debugger_accent: red().light().step_10(), - status_bar_background: neutral().dark().step_2(), - title_bar_background: neutral().dark().step_2(), - title_bar_inactive_background: neutral().dark().step_3(), - toolbar_background: neutral().dark().step_1(), - tab_bar_background: neutral().dark().step_2(), - tab_inactive_background: neutral().dark().step_2(), - tab_active_background: neutral().dark().step_1(), - search_match_background: neutral().dark().step_5(), - panel_background: neutral().dark().step_2(), - panel_focused_border: blue().dark().step_8(), - panel_indent_guide: neutral().dark_alpha().step_4(), - panel_indent_guide_hover: neutral().dark_alpha().step_6(), - panel_indent_guide_active: neutral().dark_alpha().step_6(), - pane_focused_border: blue().dark().step_5(), - pane_group_border: neutral().dark().step_6(), - scrollbar_thumb_background: neutral().dark_alpha().step_3(), - scrollbar_thumb_hover_background: neutral().dark_alpha().step_4(), - scrollbar_thumb_active_background: neutral().dark_alpha().step_5(), - scrollbar_thumb_border: gpui::transparent_black(), - scrollbar_track_background: gpui::transparent_black(), - scrollbar_track_border: neutral().dark().step_5(), - minimap_thumb_background: neutral().dark_alpha().step_3().alpha(0.7), - minimap_thumb_hover_background: neutral().dark_alpha().step_4().alpha(0.7), - minimap_thumb_active_background: neutral().dark_alpha().step_5().alpha(0.7), - minimap_thumb_border: gpui::transparent_black(), - editor_foreground: neutral().dark().step_12(), - editor_background: neutral().dark().step_1(), - editor_gutter_background: neutral().dark().step_1(), - editor_subheader_background: neutral().dark().step_3(), - editor_active_line_background: neutral().dark_alpha().step_3(), - editor_highlighted_line_background: yellow().dark_alpha().step_4(), - editor_debugger_active_line_background: yellow().dark_alpha().step_3(), - editor_line_number: neutral().dark_alpha().step_10(), - editor_hover_line_number: neutral().dark_alpha().step_12(), - editor_active_line_number: neutral().dark_alpha().step_11(), - editor_invisible: neutral().dark_alpha().step_4(), - editor_wrap_guide: neutral().dark_alpha().step_4(), - editor_active_wrap_guide: neutral().dark_alpha().step_4(), - editor_indent_guide: neutral().dark_alpha().step_4(), - editor_indent_guide_active: neutral().dark_alpha().step_6(), - editor_document_highlight_read_background: neutral().dark_alpha().step_4(), - editor_document_highlight_write_background: neutral().dark_alpha().step_4(), - editor_document_highlight_bracket_background: green().dark_alpha().step_6(), - terminal_background: neutral().dark().step_1(), - terminal_ansi_background: neutral().dark().step_1(), - terminal_foreground: white().dark().step_12(), - terminal_bright_foreground: white().dark().step_11(), - terminal_dim_foreground: white().dark().step_10(), - terminal_ansi_black: black().dark().step_12(), - terminal_ansi_bright_black: black().dark().step_11(), - terminal_ansi_dim_black: black().dark().step_10(), - terminal_ansi_red: red().dark().step_11(), - terminal_ansi_bright_red: red().dark().step_10(), - terminal_ansi_dim_red: red().dark().step_9(), - terminal_ansi_green: green().dark().step_11(), - terminal_ansi_bright_green: green().dark().step_10(), - terminal_ansi_dim_green: green().dark().step_9(), - terminal_ansi_yellow: yellow().dark().step_11(), - terminal_ansi_bright_yellow: yellow().dark().step_10(), - terminal_ansi_dim_yellow: yellow().dark().step_9(), - terminal_ansi_blue: blue().dark().step_11(), - terminal_ansi_bright_blue: blue().dark().step_10(), - terminal_ansi_dim_blue: blue().dark().step_9(), - terminal_ansi_magenta: violet().dark().step_11(), - terminal_ansi_bright_magenta: violet().dark().step_10(), - terminal_ansi_dim_magenta: violet().dark().step_9(), - terminal_ansi_cyan: cyan().dark().step_11(), - terminal_ansi_bright_cyan: cyan().dark().step_10(), - terminal_ansi_dim_cyan: cyan().dark().step_9(), - terminal_ansi_white: neutral().dark().step_12(), - terminal_ansi_bright_white: neutral().dark().step_11(), - terminal_ansi_dim_white: neutral().dark().step_10(), - link_text_hover: orange().dark().step_10(), - version_control_added: ADDED_COLOR, - version_control_deleted: REMOVED_COLOR, - version_control_modified: MODIFIED_COLOR, - version_control_renamed: MODIFIED_COLOR, - version_control_conflict: orange().dark().step_12(), - version_control_ignored: gray().dark().step_12(), - version_control_conflict_marker_ours: green().dark().step_10().alpha(0.5), - version_control_conflict_marker_theirs: blue().dark().step_10().alpha(0.5), - } - } -} - -type StaticColorScale = [&'static str; 12]; - -struct StaticColorScaleSet { - scale: &'static str, - light: StaticColorScale, - light_alpha: StaticColorScale, - dark: StaticColorScale, - dark_alpha: StaticColorScale, -} - -impl TryFrom for ColorScaleSet { - type Error = anyhow::Error; - - fn try_from(value: StaticColorScaleSet) -> Result { - fn to_color_scale(scale: StaticColorScale) -> anyhow::Result { - scale - .into_iter() - .map(|color| Rgba::try_from(color).map(Hsla::from)) - .collect::, _>>() - .map(ColorScale::from_iter) - } - - Ok(Self::new( - value.scale, - to_color_scale(value.light)?, - to_color_scale(value.light_alpha)?, - to_color_scale(value.dark)?, - to_color_scale(value.dark_alpha)?, - )) - } -} - -/// Color scales used to build the default themes. -pub fn default_color_scales() -> ColorScales { - ColorScales { - gray: gray(), - mauve: mauve(), - slate: slate(), - sage: sage(), - olive: olive(), - sand: sand(), - gold: gold(), - bronze: bronze(), - brown: brown(), - yellow: yellow(), - amber: amber(), - orange: orange(), - tomato: tomato(), - red: red(), - ruby: ruby(), - crimson: crimson(), - pink: pink(), - plum: plum(), - purple: purple(), - violet: violet(), - iris: iris(), - indigo: indigo(), - blue: blue(), - cyan: cyan(), - teal: teal(), - jade: jade(), - green: green(), - grass: grass(), - lime: lime(), - mint: mint(), - sky: sky(), - black: black(), - white: white(), - } -} - -pub(crate) fn gray() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Gray", - light: [ - "#fcfcfcff", - "#f9f9f9ff", - "#f0f0f0ff", - "#e8e8e8ff", - "#e0e0e0ff", - "#d9d9d9ff", - "#cececeff", - "#bbbbbbff", - "#8d8d8dff", - "#838383ff", - "#646464ff", - "#202020ff", - ], - light_alpha: [ - "#00000003", - "#00000006", - "#0000000f", - "#00000017", - "#0000001f", - "#00000026", - "#00000031", - "#00000044", - "#00000072", - "#0000007c", - "#0000009b", - "#000000df", - ], - dark: [ - "#111111ff", - "#191919ff", - "#222222ff", - "#2a2a2aff", - "#313131ff", - "#3a3a3aff", - "#484848ff", - "#606060ff", - "#6e6e6eff", - "#7b7b7bff", - "#b4b4b4ff", - "#eeeeeeff", - ], - dark_alpha: [ - "#00000000", - "#ffffff09", - "#ffffff12", - "#ffffff1b", - "#ffffff22", - "#ffffff2c", - "#ffffff3b", - "#ffffff55", - "#ffffff64", - "#ffffff72", - "#ffffffaf", - "#ffffffed", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn mauve() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Mauve", - light: [ - "#fdfcfdff", - "#faf9fbff", - "#f2eff3ff", - "#eae7ecff", - "#e3dfe6ff", - "#dbd8e0ff", - "#d0cdd7ff", - "#bcbac7ff", - "#8e8c99ff", - "#84828eff", - "#65636dff", - "#211f26ff", - ], - light_alpha: [ - "#55005503", - "#2b005506", - "#30004010", - "#20003618", - "#20003820", - "#14003527", - "#10003332", - "#08003145", - "#05001d73", - "#0500197d", - "#0400119c", - "#020008e0", - ], - dark: [ - "#121113ff", - "#1a191bff", - "#232225ff", - "#2b292dff", - "#323035ff", - "#3c393fff", - "#49474eff", - "#625f69ff", - "#6f6d78ff", - "#7c7a85ff", - "#b5b2bcff", - "#eeeef0ff", - ], - dark_alpha: [ - "#00000000", - "#f5f4f609", - "#ebeaf814", - "#eee5f81d", - "#efe6fe25", - "#f1e6fd30", - "#eee9ff40", - "#eee7ff5d", - "#eae6fd6e", - "#ece9fd7c", - "#f5f1ffb7", - "#fdfdffef", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn slate() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Slate", - light: [ - "#fcfcfdff", - "#f9f9fbff", - "#f0f0f3ff", - "#e8e8ecff", - "#e0e1e6ff", - "#d9d9e0ff", - "#cdced6ff", - "#b9bbc6ff", - "#8b8d98ff", - "#80838dff", - "#60646cff", - "#1c2024ff", - ], - light_alpha: [ - "#00005503", - "#00005506", - "#0000330f", - "#00002d17", - "#0009321f", - "#00002f26", - "#00062e32", - "#00083046", - "#00051d74", - "#00071b7f", - "#0007149f", - "#000509e3", - ], - dark: [ - "#111113ff", - "#18191bff", - "#212225ff", - "#272a2dff", - "#2e3135ff", - "#363a3fff", - "#43484eff", - "#5a6169ff", - "#696e77ff", - "#777b84ff", - "#b0b4baff", - "#edeef0ff", - ], - dark_alpha: [ - "#00000000", - "#d8f4f609", - "#ddeaf814", - "#d3edf81d", - "#d9edfe25", - "#d6ebfd30", - "#d9edff40", - "#d9edff5d", - "#dfebfd6d", - "#e5edfd7b", - "#f1f7feb5", - "#fcfdffef", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn sage() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Sage", - light: [ - "#fbfdfcff", - "#f7f9f8ff", - "#eef1f0ff", - "#e6e9e8ff", - "#dfe2e0ff", - "#d7dad9ff", - "#cbcfcdff", - "#b8bcbaff", - "#868e8bff", - "#7c8481ff", - "#5f6563ff", - "#1a211eff", - ], - light_alpha: [ - "#00804004", - "#00402008", - "#002d1e11", - "#001f1519", - "#00180820", - "#00140d28", - "#00140a34", - "#000f0847", - "#00110b79", - "#00100a83", - "#000a07a0", - "#000805e5", - ], - dark: [ - "#101211ff", - "#171918ff", - "#202221ff", - "#272a29ff", - "#2e3130ff", - "#373b39ff", - "#444947ff", - "#5b625fff", - "#63706bff", - "#717d79ff", - "#adb5b2ff", - "#eceeedff", - ], - dark_alpha: [ - "#00000000", - "#f0f2f108", - "#f3f5f412", - "#f2fefd1a", - "#f1fbfa22", - "#edfbf42d", - "#edfcf73c", - "#ebfdf657", - "#dffdf266", - "#e5fdf674", - "#f4fefbb0", - "#fdfffeed", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn olive() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Olive", - light: [ - "#fcfdfcff", - "#f8faf8ff", - "#eff1efff", - "#e7e9e7ff", - "#dfe2dfff", - "#d7dad7ff", - "#cccfccff", - "#b9bcb8ff", - "#898e87ff", - "#7f847dff", - "#60655fff", - "#1d211cff", - ], - light_alpha: [ - "#00550003", - "#00490007", - "#00200010", - "#00160018", - "#00180020", - "#00140028", - "#000f0033", - "#040f0047", - "#050f0078", - "#040e0082", - "#020a00a0", - "#010600e3", - ], - dark: [ - "#111210ff", - "#181917ff", - "#212220ff", - "#282a27ff", - "#2f312eff", - "#383a36ff", - "#454843ff", - "#5c625bff", - "#687066ff", - "#767d74ff", - "#afb5adff", - "#eceeecff", - ], - dark_alpha: [ - "#00000000", - "#f1f2f008", - "#f4f5f312", - "#f3fef21a", - "#f2fbf122", - "#f4faed2c", - "#f2fced3b", - "#edfdeb57", - "#ebfde766", - "#f0fdec74", - "#f6fef4b0", - "#fdfffded", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn sand() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Sand", - light: [ - "#fdfdfcff", - "#f9f9f8ff", - "#f1f0efff", - "#e9e8e6ff", - "#e2e1deff", - "#dad9d6ff", - "#cfcecaff", - "#bcbbb5ff", - "#8d8d86ff", - "#82827cff", - "#63635eff", - "#21201cff", - ], - light_alpha: [ - "#55550003", - "#25250007", - "#20100010", - "#1f150019", - "#1f180021", - "#19130029", - "#19140035", - "#1915014a", - "#0f0f0079", - "#0c0c0083", - "#080800a1", - "#060500e3", - ], - dark: [ - "#111110ff", - "#191918ff", - "#222221ff", - "#2a2a28ff", - "#31312eff", - "#3b3a37ff", - "#494844ff", - "#62605bff", - "#6f6d66ff", - "#7c7b74ff", - "#b5b3adff", - "#eeeeecff", - ], - dark_alpha: [ - "#00000000", - "#f4f4f309", - "#f6f6f513", - "#fefef31b", - "#fbfbeb23", - "#fffaed2d", - "#fffbed3c", - "#fff9eb57", - "#fffae965", - "#fffdee73", - "#fffcf4b0", - "#fffffded", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn gold() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Gold", - light: [ - "#fdfdfcff", - "#faf9f2ff", - "#f2f0e7ff", - "#eae6dbff", - "#e1dccfff", - "#d8d0bfff", - "#cbc0aaff", - "#b9a88dff", - "#978365ff", - "#8c7a5eff", - "#71624bff", - "#3b352bff", - ], - light_alpha: [ - "#55550003", - "#9d8a000d", - "#75600018", - "#6b4e0024", - "#60460030", - "#64440040", - "#63420055", - "#633d0072", - "#5332009a", - "#492d00a1", - "#362100b4", - "#130c00d4", - ], - dark: [ - "#121211ff", - "#1b1a17ff", - "#24231fff", - "#2d2b26ff", - "#38352eff", - "#444039ff", - "#544f46ff", - "#696256ff", - "#978365ff", - "#a39073ff", - "#cbb99fff", - "#e8e2d9ff", - ], - dark_alpha: [ - "#91911102", - "#f9e29d0b", - "#f8ecbb15", - "#ffeec41e", - "#feecc22a", - "#feebcb37", - "#ffedcd48", - "#fdeaca5f", - "#ffdba690", - "#fedfb09d", - "#fee7c6c8", - "#fef7ede7", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn bronze() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Bronze", - light: [ - "#fdfcfcff", - "#fdf7f5ff", - "#f6edeaff", - "#efe4dfff", - "#e7d9d3ff", - "#dfcdc5ff", - "#d3bcb3ff", - "#c2a499ff", - "#a18072ff", - "#957468ff", - "#7d5e54ff", - "#43302bff", - ], - light_alpha: [ - "#55000003", - "#cc33000a", - "#92250015", - "#80280020", - "#7423002c", - "#7324003a", - "#6c1f004c", - "#671c0066", - "#551a008d", - "#4c150097", - "#3d0f00ab", - "#1d0600d4", - ], - dark: [ - "#141110ff", - "#1c1917ff", - "#262220ff", - "#302a27ff", - "#3b3330ff", - "#493e3aff", - "#5a4c47ff", - "#6f5f58ff", - "#a18072ff", - "#ae8c7eff", - "#d4b3a5ff", - "#ede0d9ff", - ], - dark_alpha: [ - "#d1110004", - "#fbbc910c", - "#faceb817", - "#facdb622", - "#ffd2c12d", - "#ffd1c03c", - "#fdd0c04f", - "#ffd6c565", - "#fec7b09b", - "#fecab5a9", - "#ffd7c6d1", - "#fff1e9ec", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn brown() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Brown", - light: [ - "#fefdfcff", - "#fcf9f6ff", - "#f6eee7ff", - "#f0e4d9ff", - "#ebdacaff", - "#e4cdb7ff", - "#dcbc9fff", - "#cea37eff", - "#ad7f58ff", - "#a07553ff", - "#815e46ff", - "#3e332eff", - ], - light_alpha: [ - "#aa550003", - "#aa550009", - "#a04b0018", - "#9b4a0026", - "#9f4d0035", - "#a04e0048", - "#a34e0060", - "#9f4a0081", - "#823c00a7", - "#723300ac", - "#522100b9", - "#140600d1", - ], - dark: [ - "#12110fff", - "#1c1816ff", - "#28211dff", - "#322922ff", - "#3e3128ff", - "#4d3c2fff", - "#614a39ff", - "#7c5f46ff", - "#ad7f58ff", - "#b88c67ff", - "#dbb594ff", - "#f2e1caff", - ], - dark_alpha: [ - "#91110002", - "#fba67c0c", - "#fcb58c19", - "#fbbb8a24", - "#fcb88931", - "#fdba8741", - "#ffbb8856", - "#ffbe8773", - "#feb87da8", - "#ffc18cb3", - "#fed1aad9", - "#feecd4f2", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn yellow() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Yellow", - light: [ - "#fdfdf9ff", - "#fefce9ff", - "#fffab8ff", - "#fff394ff", - "#ffe770ff", - "#f3d768ff", - "#e4c767ff", - "#d5ae39ff", - "#ffe629ff", - "#ffdc00ff", - "#9e6c00ff", - "#473b1fff", - ], - light_alpha: [ - "#aaaa0006", - "#f4dd0016", - "#ffee0047", - "#ffe3016b", - "#ffd5008f", - "#ebbc0097", - "#d2a10098", - "#c99700c6", - "#ffe100d6", - "#ffdc00ff", - "#9e6c00ff", - "#2e2000e0", - ], - dark: [ - "#14120bff", - "#1b180fff", - "#2d2305ff", - "#362b00ff", - "#433500ff", - "#524202ff", - "#665417ff", - "#836a21ff", - "#ffe629ff", - "#ffff57ff", - "#f5e147ff", - "#f6eeb4ff", - ], - dark_alpha: [ - "#d1510004", - "#f9b4000b", - "#ffaa001e", - "#fdb70028", - "#febb0036", - "#fec40046", - "#fdcb225c", - "#fdca327b", - "#ffe629ff", - "#ffff57ff", - "#fee949f5", - "#fef6baf6", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn amber() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Amber", - light: [ - "#fefdfbff", - "#fefbe9ff", - "#fff7c2ff", - "#ffee9cff", - "#fbe577ff", - "#f3d673ff", - "#e9c162ff", - "#e2a336ff", - "#ffc53dff", - "#ffba18ff", - "#ab6400ff", - "#4f3422ff", - ], - light_alpha: [ - "#c0800004", - "#f4d10016", - "#ffde003d", - "#ffd40063", - "#f8cf0088", - "#eab5008c", - "#dc9b009d", - "#da8a00c9", - "#ffb300c2", - "#ffb300e7", - "#ab6400ff", - "#341500dd", - ], - dark: [ - "#16120cff", - "#1d180fff", - "#302008ff", - "#3f2700ff", - "#4d3000ff", - "#5c3d05ff", - "#714f19ff", - "#8f6424ff", - "#ffc53dff", - "#ffd60aff", - "#ffca16ff", - "#ffe7b3ff", - ], - dark_alpha: [ - "#e63c0006", - "#fd9b000d", - "#fa820022", - "#fc820032", - "#fd8b0041", - "#fd9b0051", - "#ffab2567", - "#ffae3587", - "#ffc53dff", - "#ffd60aff", - "#ffca16ff", - "#ffe7b3ff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn orange() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Orange", - light: [ - "#fefcfbff", - "#fff7edff", - "#ffefd6ff", - "#ffdfb5ff", - "#ffd19aff", - "#ffc182ff", - "#f5ae73ff", - "#ec9455ff", - "#f76b15ff", - "#ef5f00ff", - "#cc4e00ff", - "#582d1dff", - ], - light_alpha: [ - "#c0400004", - "#ff8e0012", - "#ff9c0029", - "#ff91014a", - "#ff8b0065", - "#ff81007d", - "#ed6c008c", - "#e35f00aa", - "#f65e00ea", - "#ef5f00ff", - "#cc4e00ff", - "#431200e2", - ], - dark: [ - "#17120eff", - "#1e160fff", - "#331e0bff", - "#462100ff", - "#562800ff", - "#66350cff", - "#7e451dff", - "#a35829ff", - "#f76b15ff", - "#ff801fff", - "#ffa057ff", - "#ffe0c2ff", - ], - dark_alpha: [ - "#ec360007", - "#fe6d000e", - "#fb6a0025", - "#ff590039", - "#ff61004a", - "#fd75045c", - "#ff832c75", - "#fe84389d", - "#fe6d15f7", - "#ff801fff", - "#ffa057ff", - "#ffe0c2ff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn tomato() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Tomato", - light: [ - "#fffcfcff", - "#fff8f7ff", - "#feebe7ff", - "#ffdcd3ff", - "#ffcdc2ff", - "#fdbdafff", - "#f5a898ff", - "#ec8e7bff", - "#e54d2eff", - "#dd4425ff", - "#d13415ff", - "#5c271fff", - ], - light_alpha: [ - "#ff000003", - "#ff200008", - "#f52b0018", - "#ff35002c", - "#ff2e003d", - "#f92d0050", - "#e7280067", - "#db250084", - "#df2600d1", - "#d72400da", - "#cd2200ea", - "#460900e0", - ], - dark: [ - "#181111ff", - "#1f1513ff", - "#391714ff", - "#4e1511ff", - "#5e1c16ff", - "#6e2920ff", - "#853a2dff", - "#ac4d39ff", - "#e54d2eff", - "#ec6142ff", - "#ff977dff", - "#fbd3cbff", - ], - dark_alpha: [ - "#f1121208", - "#ff55330f", - "#ff35232b", - "#fd201142", - "#fe332153", - "#ff4f3864", - "#fd644a7d", - "#fe6d4ea7", - "#fe5431e4", - "#ff6847eb", - "#ff977dff", - "#ffd6cefb", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn red() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Red", - light: [ - "#fffcfcff", - "#fff7f7ff", - "#feebecff", - "#ffdbdcff", - "#ffcdceff", - "#fdbdbeff", - "#f4a9aaff", - "#eb8e90ff", - "#e5484dff", - "#dc3e42ff", - "#ce2c31ff", - "#641723ff", - ], - light_alpha: [ - "#ff000003", - "#ff000008", - "#f3000d14", - "#ff000824", - "#ff000632", - "#f8000442", - "#df000356", - "#d2000571", - "#db0007b7", - "#d10005c1", - "#c40006d3", - "#55000de8", - ], - dark: [ - "#191111ff", - "#201314ff", - "#3b1219ff", - "#500f1cff", - "#611623ff", - "#72232dff", - "#8c333aff", - "#b54548ff", - "#e5484dff", - "#ec5d5eff", - "#ff9592ff", - "#ffd1d9ff", - ], - dark_alpha: [ - "#f4121209", - "#f22f3e11", - "#ff173f2d", - "#fe0a3b44", - "#ff204756", - "#ff3e5668", - "#ff536184", - "#ff5d61b0", - "#fe4e54e4", - "#ff6465eb", - "#ff9592ff", - "#ffd1d9ff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn ruby() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Ruby", - light: [ - "#fffcfdff", - "#fff7f8ff", - "#feeaedff", - "#ffdce1ff", - "#ffced6ff", - "#f8bfc8ff", - "#efacb8ff", - "#e592a3ff", - "#e54666ff", - "#dc3b5dff", - "#ca244dff", - "#64172bff", - ], - light_alpha: [ - "#ff005503", - "#ff002008", - "#f3002515", - "#ff002523", - "#ff002a31", - "#e4002440", - "#ce002553", - "#c300286d", - "#db002cb9", - "#d2002cc4", - "#c10030db", - "#550016e8", - ], - dark: [ - "#191113ff", - "#1e1517ff", - "#3a141eff", - "#4e1325ff", - "#5e1a2eff", - "#6f2539ff", - "#883447ff", - "#b3445aff", - "#e54666ff", - "#ec5a72ff", - "#ff949dff", - "#fed2e1ff", - ], - dark_alpha: [ - "#f4124a09", - "#fe5a7f0e", - "#ff235d2c", - "#fd195e42", - "#fe2d6b53", - "#ff447665", - "#ff577d80", - "#ff5c7cae", - "#fe4c70e4", - "#ff617beb", - "#ff949dff", - "#ffd3e2fe", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn crimson() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Crimson", - light: [ - "#fffcfdff", - "#fef7f9ff", - "#ffe9f0ff", - "#fedce7ff", - "#faceddff", - "#f3bed1ff", - "#eaacc3ff", - "#e093b2ff", - "#e93d82ff", - "#df3478ff", - "#cb1d63ff", - "#621639ff", - ], - light_alpha: [ - "#ff005503", - "#e0004008", - "#ff005216", - "#f8005123", - "#e5004f31", - "#d0004b41", - "#bf004753", - "#b6004a6c", - "#e2005bc2", - "#d70056cb", - "#c4004fe2", - "#530026e9", - ], - dark: [ - "#191114ff", - "#201318ff", - "#381525ff", - "#4d122fff", - "#5c1839ff", - "#6d2545ff", - "#873356ff", - "#b0436eff", - "#e93d82ff", - "#ee518aff", - "#ff92adff", - "#fdd3e8ff", - ], - dark_alpha: [ - "#f4126709", - "#f22f7a11", - "#fe2a8b2a", - "#fd158741", - "#fd278f51", - "#fe459763", - "#fd559b7f", - "#fe5b9bab", - "#fe418de8", - "#ff5693ed", - "#ff92adff", - "#ffd5eafd", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn pink() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Pink", - light: [ - "#fffcfeff", - "#fef7fbff", - "#fee9f5ff", - "#fbdcefff", - "#f6cee7ff", - "#efbfddff", - "#e7acd0ff", - "#dd93c2ff", - "#d6409fff", - "#cf3897ff", - "#c2298aff", - "#651249ff", - ], - light_alpha: [ - "#ff00aa03", - "#e0008008", - "#f4008c16", - "#e2008b23", - "#d1008331", - "#c0007840", - "#b6006f53", - "#af006f6c", - "#c8007fbf", - "#c2007ac7", - "#b60074d6", - "#59003bed", - ], - dark: [ - "#191117ff", - "#21121dff", - "#37172fff", - "#4b143dff", - "#591c47ff", - "#692955ff", - "#833869ff", - "#a84885ff", - "#d6409fff", - "#de51a8ff", - "#ff8dccff", - "#fdd1eaff", - ], - dark_alpha: [ - "#f412bc09", - "#f420bb12", - "#fe37cc29", - "#fc1ec43f", - "#fd35c24e", - "#fd51c75f", - "#fd62c87b", - "#ff68c8a2", - "#fe49bcd4", - "#ff5cc0dc", - "#ff8dccff", - "#ffd3ecfd", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn plum() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Plum", - light: [ - "#fefcffff", - "#fdf7fdff", - "#fbebfbff", - "#f7def8ff", - "#f2d1f3ff", - "#e9c2ecff", - "#deade3ff", - "#cf91d8ff", - "#ab4abaff", - "#a144afff", - "#953ea3ff", - "#53195dff", - ], - light_alpha: [ - "#aa00ff03", - "#c000c008", - "#cc00cc14", - "#c200c921", - "#b700bd2e", - "#a400b03d", - "#9900a852", - "#9000a56e", - "#89009eb5", - "#7f0092bb", - "#730086c1", - "#40004be6", - ], - dark: [ - "#181118ff", - "#201320ff", - "#351a35ff", - "#451d47ff", - "#512454ff", - "#5e3061ff", - "#734079ff", - "#92549cff", - "#ab4abaff", - "#b658c4ff", - "#e796f3ff", - "#f4d4f4ff", - ], - dark_alpha: [ - "#f112f108", - "#f22ff211", - "#fd4cfd27", - "#f646ff3a", - "#f455ff48", - "#f66dff56", - "#f07cfd70", - "#ee84ff95", - "#e961feb6", - "#ed70ffc0", - "#f19cfef3", - "#feddfef4", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn purple() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Purple", - light: [ - "#fefcfeff", - "#fbf7feff", - "#f7edfeff", - "#f2e2fcff", - "#ead5f9ff", - "#e0c4f4ff", - "#d1afecff", - "#be93e4ff", - "#8e4ec6ff", - "#8347b9ff", - "#8145b5ff", - "#402060ff", - ], - light_alpha: [ - "#aa00aa03", - "#8000e008", - "#8e00f112", - "#8d00e51d", - "#8000db2a", - "#7a01d03b", - "#6d00c350", - "#6600c06c", - "#5c00adb1", - "#53009eb8", - "#52009aba", - "#250049df", - ], - dark: [ - "#18111bff", - "#1e1523ff", - "#301c3bff", - "#3d224eff", - "#48295cff", - "#54346bff", - "#664282ff", - "#8457aaff", - "#8e4ec6ff", - "#9a5cd0ff", - "#d19dffff", - "#ecd9faff", - ], - dark_alpha: [ - "#b412f90b", - "#b744f714", - "#c150ff2d", - "#bb53fd42", - "#be5cfd51", - "#c16dfd61", - "#c378fd7a", - "#c47effa4", - "#b661ffc2", - "#bc6fffcd", - "#d19dffff", - "#f1ddfffa", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn violet() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Violet", - light: [ - "#fdfcfeff", - "#faf8ffff", - "#f4f0feff", - "#ebe4ffff", - "#e1d9ffff", - "#d4cafeff", - "#c2b5f5ff", - "#aa99ecff", - "#6e56cfff", - "#654dc4ff", - "#6550b9ff", - "#2f265fff", - ], - light_alpha: [ - "#5500aa03", - "#4900ff07", - "#4400ee0f", - "#4300ff1b", - "#3600ff26", - "#3100fb35", - "#2d01dd4a", - "#2b00d066", - "#2400b7a9", - "#2300abb2", - "#1f0099af", - "#0b0043d9", - ], - dark: [ - "#14121fff", - "#1b1525ff", - "#291f43ff", - "#33255bff", - "#3c2e69ff", - "#473876ff", - "#56468bff", - "#6958adff", - "#6e56cfff", - "#7d66d9ff", - "#baa7ffff", - "#e2ddfeff", - ], - dark_alpha: [ - "#4422ff0f", - "#853ff916", - "#8354fe36", - "#7d51fd50", - "#845ffd5f", - "#8f6cfd6d", - "#9879ff83", - "#977dfea8", - "#8668ffcc", - "#9176fed7", - "#baa7ffff", - "#e3defffe", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn iris() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Iris", - light: [ - "#fdfdffff", - "#f8f8ffff", - "#f0f1feff", - "#e6e7ffff", - "#dadcffff", - "#cbcdffff", - "#b8baf8ff", - "#9b9ef0ff", - "#5b5bd6ff", - "#5151cdff", - "#5753c6ff", - "#272962ff", - ], - light_alpha: [ - "#0000ff02", - "#0000ff07", - "#0011ee0f", - "#000bff19", - "#000eff25", - "#000aff34", - "#0008e647", - "#0008d964", - "#0000c0a4", - "#0000b6ae", - "#0600abac", - "#000246d8", - ], - dark: [ - "#13131eff", - "#171625ff", - "#202248ff", - "#262a65ff", - "#303374ff", - "#3d3e82ff", - "#4a4a95ff", - "#5958b1ff", - "#5b5bd6ff", - "#6e6adeff", - "#b1a9ffff", - "#e0dffeff", - ], - dark_alpha: [ - "#3636fe0e", - "#564bf916", - "#525bff3b", - "#4d58ff5a", - "#5b62fd6b", - "#6d6ffd7a", - "#7777fe8e", - "#7b7afeac", - "#6a6afed4", - "#7d79ffdc", - "#b1a9ffff", - "#e1e0fffe", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn indigo() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Indigo", - light: [ - "#fdfdfeff", - "#f7f9ffff", - "#edf2feff", - "#e1e9ffff", - "#d2deffff", - "#c1d0ffff", - "#abbdf9ff", - "#8da4efff", - "#3e63ddff", - "#3358d4ff", - "#3a5bc7ff", - "#1f2d5cff", - ], - light_alpha: [ - "#00008002", - "#0040ff08", - "#0047f112", - "#0044ff1e", - "#0044ff2d", - "#003eff3e", - "#0037ed54", - "#0034dc72", - "#0031d2c1", - "#002ec9cc", - "#002bb7c5", - "#001046e0", - ], - dark: [ - "#11131fff", - "#141726ff", - "#182449ff", - "#1d2e62ff", - "#253974ff", - "#304384ff", - "#3a4f97ff", - "#435db1ff", - "#3e63ddff", - "#5472e4ff", - "#9eb1ffff", - "#d6e1ffff", - ], - dark_alpha: [ - "#1133ff0f", - "#3354fa17", - "#2f62ff3c", - "#3566ff57", - "#4171fd6b", - "#5178fd7c", - "#5a7fff90", - "#5b81feac", - "#4671ffdb", - "#5c7efee3", - "#9eb1ffff", - "#d6e1ffff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn blue() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Blue", - light: [ - "#fbfdffff", - "#f4faffff", - "#e6f4feff", - "#d5efffff", - "#c2e5ffff", - "#acd8fcff", - "#8ec8f6ff", - "#5eb1efff", - "#0090ffff", - "#0588f0ff", - "#0d74ceff", - "#113264ff", - ], - light_alpha: [ - "#0080ff04", - "#008cff0b", - "#008ff519", - "#009eff2a", - "#0093ff3d", - "#0088f653", - "#0083eb71", - "#0084e6a1", - "#0090ffff", - "#0086f0fa", - "#006dcbf2", - "#002359ee", - ], - dark: [ - "#0d1520ff", - "#111927ff", - "#0d2847ff", - "#003362ff", - "#004074ff", - "#104d87ff", - "#205d9eff", - "#2870bdff", - "#0090ffff", - "#3b9effff", - "#70b8ffff", - "#c2e6ffff", - ], - dark_alpha: [ - "#004df211", - "#1166fb18", - "#0077ff3a", - "#0075ff57", - "#0081fd6b", - "#0f89fd7f", - "#2a91fe98", - "#3094feb9", - "#0090ffff", - "#3b9effff", - "#70b8ffff", - "#c2e6ffff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn cyan() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Cyan", - light: [ - "#fafdfeff", - "#f2fafbff", - "#def7f9ff", - "#caf1f6ff", - "#b5e9f0ff", - "#9ddde7ff", - "#7dcedcff", - "#3db9cfff", - "#00a2c7ff", - "#0797b9ff", - "#107d98ff", - "#0d3c48ff", - ], - light_alpha: [ - "#0099cc05", - "#009db10d", - "#00c2d121", - "#00bcd435", - "#01b4cc4a", - "#00a7c162", - "#009fbb82", - "#00a3c0c2", - "#00a2c7ff", - "#0094b7f8", - "#007491ef", - "#00323ef2", - ], - dark: [ - "#0b161aff", - "#101b20ff", - "#082c36ff", - "#003848ff", - "#004558ff", - "#045468ff", - "#12677eff", - "#11809cff", - "#00a2c7ff", - "#23afd0ff", - "#4ccce6ff", - "#b6ecf7ff", - ], - dark_alpha: [ - "#0091f70a", - "#02a7f211", - "#00befd28", - "#00baff3b", - "#00befd4d", - "#00c7fd5e", - "#14cdff75", - "#11cfff95", - "#00cfffc3", - "#28d6ffcd", - "#52e1fee5", - "#bbf3fef7", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn teal() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Teal", - light: [ - "#fafefdff", - "#f3fbf9ff", - "#e0f8f3ff", - "#ccf3eaff", - "#b8eae0ff", - "#a1ded2ff", - "#83cdc1ff", - "#53b9abff", - "#12a594ff", - "#0d9b8aff", - "#008573ff", - "#0d3d38ff", - ], - light_alpha: [ - "#00cc9905", - "#00aa800c", - "#00c69d1f", - "#00c39633", - "#00b49047", - "#00a6855e", - "#0099807c", - "#009783ac", - "#009e8ced", - "#009684f2", - "#008573ff", - "#00332df2", - ], - dark: [ - "#0d1514ff", - "#111c1bff", - "#0d2d2aff", - "#023b37ff", - "#084843ff", - "#145750ff", - "#1c6961ff", - "#207e73ff", - "#12a594ff", - "#0eb39eff", - "#0bd8b6ff", - "#adf0ddff", - ], - dark_alpha: [ - "#00deab05", - "#12fbe60c", - "#00ffe61e", - "#00ffe92d", - "#00ffea3b", - "#1cffe84b", - "#2efde85f", - "#32ffe775", - "#13ffe49f", - "#0dffe0ae", - "#0afed5d6", - "#b8ffebef", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn jade() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Jade", - light: [ - "#fbfefdff", - "#f4fbf7ff", - "#e6f7edff", - "#d6f1e3ff", - "#c3e9d7ff", - "#acdec8ff", - "#8bceb6ff", - "#56ba9fff", - "#29a383ff", - "#26997bff", - "#208368ff", - "#1d3b31ff", - ], - light_alpha: [ - "#00c08004", - "#00a3460b", - "#00ae4819", - "#00a85129", - "#00a2553c", - "#009a5753", - "#00945f74", - "#00976ea9", - "#00916bd6", - "#008764d9", - "#007152df", - "#002217e2", - ], - dark: [ - "#0d1512ff", - "#121c18ff", - "#0f2e22ff", - "#0b3b2cff", - "#114837ff", - "#1b5745ff", - "#246854ff", - "#2a7e68ff", - "#29a383ff", - "#27b08bff", - "#1fd8a4ff", - "#adf0d4ff", - ], - dark_alpha: [ - "#00de4505", - "#27fba60c", - "#02f99920", - "#00ffaa2d", - "#11ffb63b", - "#34ffc24b", - "#45fdc75e", - "#48ffcf75", - "#38feca9d", - "#31fec7ab", - "#21fec0d6", - "#b8ffe1ef", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn green() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Green", - light: [ - "#fbfefcff", - "#f4fbf6ff", - "#e6f6ebff", - "#d6f1dfff", - "#c4e8d1ff", - "#adddc0ff", - "#8eceaaff", - "#5bb98bff", - "#30a46cff", - "#2b9a66ff", - "#218358ff", - "#193b2dff", - ], - light_alpha: [ - "#00c04004", - "#00a32f0b", - "#00a43319", - "#00a83829", - "#019c393b", - "#00963c52", - "#00914071", - "#00924ba4", - "#008f4acf", - "#008647d4", - "#00713fde", - "#002616e6", - ], - dark: [ - "#0e1512ff", - "#121b17ff", - "#132d21ff", - "#113b29ff", - "#174933ff", - "#20573eff", - "#28684aff", - "#2f7c57ff", - "#30a46cff", - "#33b074ff", - "#3dd68cff", - "#b1f1cbff", - ], - dark_alpha: [ - "#00de4505", - "#29f99d0b", - "#22ff991e", - "#11ff992d", - "#2bffa23c", - "#44ffaa4b", - "#50fdac5e", - "#54ffad73", - "#44ffa49e", - "#43fea4ab", - "#46fea5d4", - "#bbffd7f0", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn grass() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Grass", - light: [ - "#fbfefbff", - "#f5fbf5ff", - "#e9f6e9ff", - "#daf1dbff", - "#c9e8caff", - "#b2ddb5ff", - "#94ce9aff", - "#65ba74ff", - "#46a758ff", - "#3e9b4fff", - "#2a7e3bff", - "#203c25ff", - ], - light_alpha: [ - "#00c00004", - "#0099000a", - "#00970016", - "#009f0725", - "#00930536", - "#008f0a4d", - "#018b0f6b", - "#008d199a", - "#008619b9", - "#007b17c1", - "#006514d5", - "#002006df", - ], - dark: [ - "#0e1511ff", - "#141a15ff", - "#1b2a1eff", - "#1d3a24ff", - "#25482dff", - "#2d5736ff", - "#366740ff", - "#3e7949ff", - "#46a758ff", - "#53b365ff", - "#71d083ff", - "#c2f0c2ff", - ], - dark_alpha: [ - "#00de1205", - "#5ef7780a", - "#70fe8c1b", - "#57ff802c", - "#68ff8b3b", - "#71ff8f4b", - "#77fd925d", - "#77fd9070", - "#65ff82a1", - "#72ff8dae", - "#89ff9fcd", - "#ceffceef", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn lime() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Lime", - light: [ - "#fcfdfaff", - "#f8faf3ff", - "#eef6d6ff", - "#e2f0bdff", - "#d3e7a6ff", - "#c2da91ff", - "#abc978ff", - "#8db654ff", - "#bdee63ff", - "#b0e64cff", - "#5c7c2fff", - "#37401cff", - ], - light_alpha: [ - "#66990005", - "#6b95000c", - "#96c80029", - "#8fc60042", - "#81bb0059", - "#72aa006e", - "#61990087", - "#559200ab", - "#93e4009c", - "#8fdc00b3", - "#375f00d0", - "#1e2900e3", - ], - dark: [ - "#11130cff", - "#151a10ff", - "#1f2917ff", - "#29371dff", - "#334423ff", - "#3d522aff", - "#496231ff", - "#577538ff", - "#bdee63ff", - "#d4ff70ff", - "#bde56cff", - "#e3f7baff", - ], - dark_alpha: [ - "#11bb0003", - "#78f7000a", - "#9bfd4c1a", - "#a7fe5c29", - "#affe6537", - "#b2fe6d46", - "#b6ff6f57", - "#b6fd6d6c", - "#caff69ed", - "#d4ff70ff", - "#d1fe77e4", - "#e9febff7", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn mint() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Mint", - light: [ - "#f9fefdff", - "#f2fbf9ff", - "#ddf9f2ff", - "#c8f4e9ff", - "#b3ecdeff", - "#9ce0d0ff", - "#7ecfbdff", - "#4cbba5ff", - "#86ead4ff", - "#7de0cbff", - "#027864ff", - "#16433cff", - ], - light_alpha: [ - "#00d5aa06", - "#00b18a0d", - "#00d29e22", - "#00cc9937", - "#00c0914c", - "#00b08663", - "#00a17d81", - "#009e7fb3", - "#00d3a579", - "#00c39982", - "#007763fd", - "#00312ae9", - ], - dark: [ - "#0e1515ff", - "#0f1b1bff", - "#092c2bff", - "#003a38ff", - "#004744ff", - "#105650ff", - "#1e685fff", - "#277f70ff", - "#86ead4ff", - "#a8f5e5ff", - "#58d5baff", - "#c4f5e1ff", - ], - dark_alpha: [ - "#00dede05", - "#00f9f90b", - "#00fff61d", - "#00fff42c", - "#00fff23a", - "#0effeb4a", - "#34fde55e", - "#41ffdf76", - "#92ffe7e9", - "#aefeedf5", - "#67ffded2", - "#cbfee9f5", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn sky() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Sky", - light: [ - "#f9feffff", - "#f1fafdff", - "#e1f6fdff", - "#d1f0faff", - "#bee7f5ff", - "#a9daedff", - "#8dcae3ff", - "#60b3d7ff", - "#7ce2feff", - "#74daf8ff", - "#00749eff", - "#1d3e56ff", - ], - light_alpha: [ - "#00d5ff06", - "#00a4db0e", - "#00b3ee1e", - "#00ace42e", - "#00a1d841", - "#0092ca56", - "#0089c172", - "#0085bf9f", - "#00c7fe83", - "#00bcf38b", - "#00749eff", - "#002540e2", - ], - dark: [ - "#0d141fff", - "#111a27ff", - "#112840ff", - "#113555ff", - "#154467ff", - "#1b537bff", - "#1f6692ff", - "#197caeff", - "#7ce2feff", - "#a8eeffff", - "#75c7f0ff", - "#c2f3ffff", - ], - dark_alpha: [ - "#0044ff0f", - "#1171fb18", - "#1184fc33", - "#128fff49", - "#1c9dfd5d", - "#28a5ff72", - "#2badfe8b", - "#1db2fea9", - "#7ce3fffe", - "#a8eeffff", - "#7cd3ffef", - "#c2f3ffff", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn black() -> ColorScaleSet { - StaticColorScaleSet { - scale: "Black", - light: [ - "#0000000d", - "#0000001a", - "#00000026", - "#00000033", - "#0000004d", - "#00000066", - "#00000080", - "#00000099", - "#000000b3", - "#000000cc", - "#000000e6", - "#000000f2", - ], - light_alpha: [ - "#0000000d", - "#0000001a", - "#00000026", - "#00000033", - "#0000004d", - "#00000066", - "#00000080", - "#00000099", - "#000000b3", - "#000000cc", - "#000000e6", - "#000000f2", - ], - dark: [ - "#0000000d", - "#0000001a", - "#00000026", - "#00000033", - "#0000004d", - "#00000066", - "#00000080", - "#00000099", - "#000000b3", - "#000000cc", - "#000000e6", - "#000000f2", - ], - dark_alpha: [ - "#0000000d", - "#0000001a", - "#00000026", - "#00000033", - "#0000004d", - "#00000066", - "#00000080", - "#00000099", - "#000000b3", - "#000000cc", - "#000000e6", - "#000000f2", - ], - } - .try_into() - .unwrap() -} - -pub(crate) fn white() -> ColorScaleSet { - StaticColorScaleSet { - scale: "White", - light: [ - "#ffffff0d", - "#ffffff1a", - "#ffffff26", - "#ffffff33", - "#ffffff4d", - "#ffffff66", - "#ffffff80", - "#ffffff99", - "#ffffffb3", - "#ffffffcc", - "#ffffffe6", - "#fffffff2", - ], - light_alpha: [ - "#ffffff0d", - "#ffffff1a", - "#ffffff26", - "#ffffff33", - "#ffffff4d", - "#ffffff66", - "#ffffff80", - "#ffffff99", - "#ffffffb3", - "#ffffffcc", - "#ffffffe6", - "#fffffff2", - ], - dark: [ - "#ffffff0d", - "#ffffff1a", - "#ffffff26", - "#ffffff33", - "#ffffff4d", - "#ffffff66", - "#ffffff80", - "#ffffff99", - "#ffffffb3", - "#ffffffcc", - "#ffffffe6", - "#fffffff2", - ], - dark_alpha: [ - "#ffffff0d", - "#ffffff1a", - "#ffffff26", - "#ffffff33", - "#ffffff4d", - "#ffffff66", - "#ffffff80", - "#ffffff99", - "#ffffffb3", - "#ffffffcc", - "#ffffffe6", - "#fffffff2", - ], - } - .try_into() - .unwrap() -} diff --git a/crates/theme/src/fallback_themes.rs b/crates/theme/src/fallback_themes.rs deleted file mode 100644 index 5e9967d4603a5bac8c9f1a7e461c7319f52f82d7..0000000000000000000000000000000000000000 --- a/crates/theme/src/fallback_themes.rs +++ /dev/null @@ -1,344 +0,0 @@ -use std::sync::Arc; - -use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance, hsla}; - -use crate::{ - AccentColors, Appearance, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme, - SystemColors, Theme, ThemeColors, ThemeColorsRefinement, ThemeFamily, ThemeStyles, - default_color_scales, -}; - -/// The default 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 { - ThemeFamily { - id: "zed-default".to_string(), - name: "Zed Default".into(), - author: "".into(), - themes: vec![zed_default_dark()], - scales: default_color_scales(), - } -} - -// If a theme customizes a foreground version of a status color, but does not -// customize the background color, then use a partly-transparent version of the -// foreground color for the background color. -pub(crate) fn apply_status_color_defaults(status: &mut StatusColorsRefinement) { - for (fg_color, bg_color) in [ - (&status.deleted, &mut status.deleted_background), - (&status.created, &mut status.created_background), - (&status.modified, &mut status.modified_background), - (&status.conflict, &mut status.conflict_background), - (&status.error, &mut status.error_background), - (&status.hidden, &mut status.hidden_background), - ] { - if bg_color.is_none() { - if let Some(fg_color) = fg_color { - *bg_color = Some(fg_color.opacity(0.25)); - } - } - } -} - -pub(crate) fn apply_theme_color_defaults( - theme_colors: &mut ThemeColorsRefinement, - player_colors: &PlayerColors, -) { - if theme_colors.element_selection_background.is_none() { - let mut selection = player_colors.local().selection; - if selection.a == 1.0 { - selection.a = 0.25; - } - theme_colors.element_selection_background = Some(selection); - } -} - -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, - }; - - let player = PlayerColors::dark(); - Theme { - id: "one_dark".to_string(), - 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]), - 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_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), - element_disabled: SystemColors::default().transparent, - element_selection_background: player.local().selection.alpha(0.25), - drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0), - 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_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.), - 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_track_background: gpui::transparent_black(), - scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.), - minimap_thumb_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 0.7), - minimap_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 0.7), - minimap_thumb_active_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 0.7), - minimap_thumb_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_marker_ours: crate::green().light().step_12().alpha(0.5), - version_control_conflict_marker_theirs: crate::blue().light().step_12().alpha(0.5), - }, - 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, - }, - player, - 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()), - ("embedded".into(), HighlightStyle::default()), - ( - "emphasis".into(), - HighlightStyle { - font_style: Some(FontStyle::Italic), - ..HighlightStyle::default() - }, - ), - ( - "emphasis.strong".into(), - HighlightStyle { - font_weight: Some(FontWeight::BOLD), - ..HighlightStyle::default() - }, - ), - ("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()), - ("label".into(), HighlightStyle::default()), - ("link_text".into(), blue.into()), - ( - "link_uri".into(), - HighlightStyle { - color: Some(teal), - font_style: Some(FontStyle::Italic), - ..HighlightStyle::default() - }, - ), - ("number".into(), orange.into()), - ("operator".into(), HighlightStyle::default()), - ("predictive".into(), HighlightStyle::default()), - ("preproc".into(), HighlightStyle::default()), - ("primary".into(), HighlightStyle::default()), - ("property".into(), red.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.escape".into(), HighlightStyle::default()), - ("string.regex".into(), red.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()), - ("variable".into(), HighlightStyle::default()), - ("variable.special".into(), red.into()), - ("variant".into(), HighlightStyle::default()), - ], - }), - }, - } -} diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index f0f0776582e3b0174a3743ad6c1b20c0fd90b0d8..d8a0beb8a0ccc40824bdc065f112f7b0aea7baee 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -1,6 +1,7 @@ use std::sync::Arc; use std::{fmt::Debug, path::Path}; +use crate::default::default_theme_family; use anyhow::{Context as _, Result}; use collections::HashMap; use derive_more::{Deref, DerefMut}; @@ -91,7 +92,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([default_theme_family()]); let default_icon_theme = crate::default_icon_theme(); registry diff --git a/crates/theme/src/scale.rs b/crates/theme/src/scale.rs deleted file mode 100644 index 70c6114cc6aa240d0de1b442a08583b66cebaf3b..0000000000000000000000000000000000000000 --- a/crates/theme/src/scale.rs +++ /dev/null @@ -1,298 +0,0 @@ -#![allow(missing_docs)] -use gpui::{App, Hsla, SharedString}; - -use crate::{ActiveTheme, Appearance}; - -/// A collection of colors that are used to style the UI. -/// -/// Each step has a semantic meaning, and is used to style different parts of the UI. -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] -pub struct ColorScaleStep(usize); - -impl ColorScaleStep { - pub const ONE: Self = Self(1); - pub const TWO: Self = Self(2); - pub const THREE: Self = Self(3); - pub const FOUR: Self = Self(4); - pub const FIVE: Self = Self(5); - pub const SIX: Self = Self(6); - pub const SEVEN: Self = Self(7); - pub const EIGHT: Self = Self(8); - pub const NINE: Self = Self(9); - pub const TEN: Self = Self(10); - pub const ELEVEN: Self = Self(11); - pub const TWELVE: Self = Self(12); - - /// All of the steps in a [`ColorScale`]. - pub const ALL: [ColorScaleStep; 12] = [ - Self::ONE, - Self::TWO, - Self::THREE, - Self::FOUR, - Self::FIVE, - Self::SIX, - Self::SEVEN, - Self::EIGHT, - Self::NINE, - Self::TEN, - Self::ELEVEN, - Self::TWELVE, - ]; -} - -/// A scale of colors for a given [`ColorScaleSet`]. -/// -/// Each [`ColorScale`] contains exactly 12 colors. Refer to -/// [`ColorScaleStep`] for a reference of what each step is used for. -pub struct ColorScale(Vec); - -impl FromIterator for ColorScale { - fn from_iter>(iter: T) -> Self { - Self(Vec::from_iter(iter)) - } -} - -impl ColorScale { - /// Returns the specified step in the [`ColorScale`]. - #[inline] - pub fn step(&self, step: ColorScaleStep) -> Hsla { - // Steps are one-based, so we need convert to the zero-based vec index. - self.0[step.0 - 1] - } - - /// `Step 1` - Used for main application backgrounds. - /// - /// This step provides a neutral base for any overlaying components, ideal for applications' main backdrop or empty spaces such as canvas areas. - /// - #[inline] - pub fn step_1(&self) -> Hsla { - self.step(ColorScaleStep::ONE) - } - - /// `Step 2` - Used for both main application backgrounds and subtle component backgrounds. - /// - /// Like `Step 1`, this step allows variations in background styles, from striped tables, sidebar backgrounds, to card backgrounds. - #[inline] - pub fn step_2(&self) -> Hsla { - self.step(ColorScaleStep::TWO) - } - - /// `Step 3` - Used for UI component backgrounds in their normal states. - /// - /// This step maintains accessibility by guaranteeing a contrast ratio of 4.5:1 with steps 11 and 12 for text. It could also suit hover states for transparent components. - #[inline] - pub fn step_3(&self) -> Hsla { - self.step(ColorScaleStep::THREE) - } - - /// `Step 4` - Used for UI component backgrounds in their hover states. - /// - /// Also suited for pressed or selected states of components with a transparent background. - #[inline] - pub fn step_4(&self) -> Hsla { - self.step(ColorScaleStep::FOUR) - } - - /// `Step 5` - Used for UI component backgrounds in their pressed or selected states. - #[inline] - pub fn step_5(&self) -> Hsla { - self.step(ColorScaleStep::FIVE) - } - - /// `Step 6` - Used for subtle borders on non-interactive components. - /// - /// Its usage spans from sidebars' borders, headers' dividers, cards' outlines, to alerts' edges and separators. - #[inline] - pub fn step_6(&self) -> Hsla { - self.step(ColorScaleStep::SIX) - } - - /// `Step 7` - Used for subtle borders on interactive components. - /// - /// This step subtly delineates the boundary of elements users interact with. - #[inline] - pub fn step_7(&self) -> Hsla { - self.step(ColorScaleStep::SEVEN) - } - - /// `Step 8` - Used for stronger borders on interactive components and focus rings. - /// - /// It strengthens the visibility and accessibility of active elements and their focus states. - #[inline] - pub fn step_8(&self) -> Hsla { - self.step(ColorScaleStep::EIGHT) - } - - /// `Step 9` - Used for solid backgrounds. - /// - /// `Step 9` is the most saturated step, having the least mix of white or black. - /// - /// Due to its high chroma, `Step 9` is versatile and particularly useful for semantic colors such as - /// error, warning, and success indicators. - #[inline] - pub fn step_9(&self) -> Hsla { - self.step(ColorScaleStep::NINE) - } - - /// `Step 10` - Used for hovered or active solid backgrounds, particularly when `Step 9` is their normal state. - /// - /// May also be used for extremely low contrast text. This should be used sparingly, as it may be difficult to read. - #[inline] - pub fn step_10(&self) -> Hsla { - self.step(ColorScaleStep::TEN) - } - - /// `Step 11` - Used for text and icons requiring low contrast or less emphasis. - #[inline] - pub fn step_11(&self) -> Hsla { - self.step(ColorScaleStep::ELEVEN) - } - - /// `Step 12` - Used for text and icons requiring high contrast or prominence. - #[inline] - pub fn step_12(&self) -> Hsla { - self.step(ColorScaleStep::TWELVE) - } -} - -pub struct ColorScales { - pub gray: ColorScaleSet, - pub mauve: ColorScaleSet, - pub slate: ColorScaleSet, - pub sage: ColorScaleSet, - pub olive: ColorScaleSet, - pub sand: ColorScaleSet, - pub gold: ColorScaleSet, - pub bronze: ColorScaleSet, - pub brown: ColorScaleSet, - pub yellow: ColorScaleSet, - pub amber: ColorScaleSet, - pub orange: ColorScaleSet, - pub tomato: ColorScaleSet, - pub red: ColorScaleSet, - pub ruby: ColorScaleSet, - pub crimson: ColorScaleSet, - pub pink: ColorScaleSet, - pub plum: ColorScaleSet, - pub purple: ColorScaleSet, - pub violet: ColorScaleSet, - pub iris: ColorScaleSet, - pub indigo: ColorScaleSet, - pub blue: ColorScaleSet, - pub cyan: ColorScaleSet, - pub teal: ColorScaleSet, - pub jade: ColorScaleSet, - pub green: ColorScaleSet, - pub grass: ColorScaleSet, - pub lime: ColorScaleSet, - pub mint: ColorScaleSet, - pub sky: ColorScaleSet, - pub black: ColorScaleSet, - pub white: ColorScaleSet, -} - -impl IntoIterator for ColorScales { - type Item = ColorScaleSet; - - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - vec![ - self.gray, - self.mauve, - self.slate, - self.sage, - self.olive, - self.sand, - self.gold, - self.bronze, - self.brown, - self.yellow, - self.amber, - self.orange, - self.tomato, - self.red, - self.ruby, - self.crimson, - self.pink, - self.plum, - self.purple, - self.violet, - self.iris, - self.indigo, - self.blue, - self.cyan, - self.teal, - self.jade, - self.green, - self.grass, - self.lime, - self.mint, - self.sky, - self.black, - self.white, - ] - .into_iter() - } -} - -/// Provides groups of [`ColorScale`]s for light and dark themes, as well as transparent versions of each scale. -pub struct ColorScaleSet { - name: SharedString, - light: ColorScale, - dark: ColorScale, - light_alpha: ColorScale, - dark_alpha: ColorScale, -} - -impl ColorScaleSet { - pub fn new( - name: impl Into, - light: ColorScale, - light_alpha: ColorScale, - dark: ColorScale, - dark_alpha: ColorScale, - ) -> Self { - Self { - name: name.into(), - light, - light_alpha, - dark, - dark_alpha, - } - } - - pub fn name(&self) -> &SharedString { - &self.name - } - - pub fn light(&self) -> &ColorScale { - &self.light - } - - pub fn light_alpha(&self) -> &ColorScale { - &self.light_alpha - } - - pub fn dark(&self) -> &ColorScale { - &self.dark - } - - pub fn dark_alpha(&self) -> &ColorScale { - &self.dark_alpha - } - - pub fn step(&self, cx: &App, step: ColorScaleStep) -> Hsla { - match cx.theme().appearance { - Appearance::Light => self.light().step(step), - Appearance::Dark => self.dark().step(step), - } - } - - pub fn step_alpha(&self, cx: &App, step: ColorScaleStep) -> Hsla { - match cx.theme().appearance { - Appearance::Light => self.light_alpha.step(step), - Appearance::Dark => self.dark_alpha.step(step), - } - } -} diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rs index 1c4c90a475ca3fa155d4d7169f3f72d37193a747..26d0c175870f38176816dcc615a7ad1a18a272e3 100644 --- a/crates/theme/src/settings.rs +++ b/crates/theme/src/settings.rs @@ -1,4 +1,4 @@ -use crate::fallback_themes::zed_default_dark; +use crate::default::{DEFAULT_DARK_THEME_NAME, default_dark_theme}; use crate::{ Appearance, DEFAULT_ICON_THEME_NAME, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme, ThemeNotFoundError, ThemeRegistry, ThemeStyleContent, @@ -846,7 +846,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(&DEFAULT_DARK_THEME_NAME)) .unwrap(), theme_overrides: None, icon_theme_selection: defaults.icon_theme.clone(), diff --git a/crates/theme/src/styles/accents.rs b/crates/theme/src/styles/accents.rs index cda0ef778a6b974d715cfbdb8b0c8f9067b411cc..d551c1714de37b568a51c64f2dbcd9cb5772744a 100644 --- a/crates/theme/src/styles/accents.rs +++ b/crates/theme/src/styles/accents.rs @@ -1,10 +1,7 @@ use gpui::Hsla; use serde_derive::Deserialize; -use crate::{ - AccentContent, amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, - tomato, try_parse_color, -}; +use crate::{AccentContent, default::default_dark_theme, try_parse_color}; /// A collection of colors that are used to color indent aware lines in the editor. #[derive(Clone, Debug, Deserialize, PartialEq)] @@ -15,47 +12,7 @@ impl Default for AccentColors { /// We have to have a default to be `[refineable::Refinable]`. /// TODO "Find a way to not need this for Refinable" fn default() -> Self { - Self::dark() - } -} - -impl AccentColors { - /// Returns the set of dark accent colors. - pub fn dark() -> Self { - Self(vec![ - blue().dark().step_9(), - orange().dark().step_9(), - pink().dark().step_9(), - lime().dark().step_9(), - purple().dark().step_9(), - amber().dark().step_9(), - jade().dark().step_9(), - tomato().dark().step_9(), - cyan().dark().step_9(), - gold().dark().step_9(), - grass().dark().step_9(), - indigo().dark().step_9(), - iris().dark().step_9(), - ]) - } - - /// Returns the set of light accent colors. - pub fn light() -> Self { - Self(vec![ - blue().light().step_9(), - orange().light().step_9(), - pink().light().step_9(), - lime().light().step_9(), - purple().light().step_9(), - amber().light().step_9(), - jade().light().step_9(), - tomato().light().step_9(), - cyan().light().step_9(), - gold().light().step_9(), - grass().light().step_9(), - indigo().light().step_9(), - iris().light().step_9(), - ]) + default_dark_theme().accents().clone() } } diff --git a/crates/theme/src/styles/colors.rs b/crates/theme/src/styles/colors.rs index 4054022bde78bc2551a24742c1aff10dbecc225e..4ef8368284f6b50628e137587cab4d02cea72fb5 100644 --- a/crates/theme/src/styles/colors.rs +++ b/crates/theme/src/styles/colors.rs @@ -1,14 +1,10 @@ #![allow(missing_docs)] - -use gpui::{App, Hsla, SharedString, WindowBackgroundAppearance}; +use crate::StatusColorsRefinement; +use gpui::{Hsla, WindowBackgroundAppearance}; use refineable::Refineable; use std::sync::Arc; -use strum::{AsRefStr, EnumIter, IntoEnumIterator}; -use crate::{ - AccentColors, ActiveTheme, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme, - SystemColors, -}; +use crate::{AccentColors, PlayerColors, StatusColors, SyntaxTheme, SystemColors}; #[derive(Refineable, Clone, Debug, PartialEq)] #[refineable(Debug, serde::Deserialize)] @@ -305,11 +301,13 @@ pub struct ThemeStyles { mod tests { use serde_json::json; + use crate::default::default_dark_theme; + use super::*; #[test] fn override_a_single_theme_color() { - let mut colors = ThemeColors::light(); + let mut colors = default_dark_theme().colors().clone(); let magenta: Hsla = gpui::rgb(0xff00ff).into(); @@ -327,7 +325,7 @@ mod tests { #[test] fn override_multiple_theme_colors() { - let mut colors = ThemeColors::light(); + let mut colors = default_dark_theme().colors().clone(); let magenta: Hsla = gpui::rgb(0xff00ff).into(); let green: Hsla = gpui::rgb(0x00ff00).into(); diff --git a/crates/theme/src/styles/players.rs b/crates/theme/src/styles/players.rs index 4b1f0976b64b28a06bb7873b994d636a159bb396..038e93d79ab755701c03a737f57285268fbc31cc 100644 --- a/crates/theme/src/styles/players.rs +++ b/crates/theme/src/styles/players.rs @@ -3,9 +3,7 @@ use gpui::Hsla; use serde_derive::Deserialize; -use crate::{ - PlayerColorContent, amber, blue, jade, lime, orange, pink, purple, red, try_parse_color, -}; +use crate::{PlayerColorContent, default::default_dark_theme, try_parse_color}; #[derive(Debug, Clone, Copy, Deserialize, Default, PartialEq)] pub struct PlayerColor { @@ -28,99 +26,7 @@ impl Default for PlayerColors { /// We have to have a default to be `[refineable::Refinable]`. /// TODO "Find a way to not need this for Refinable" fn default() -> Self { - Self::dark() - } -} - -impl PlayerColors { - pub fn dark() -> Self { - Self(vec![ - PlayerColor { - cursor: blue().dark().step_9(), - background: blue().dark().step_5(), - selection: blue().dark().step_3(), - }, - PlayerColor { - cursor: orange().dark().step_9(), - background: orange().dark().step_5(), - selection: orange().dark().step_3(), - }, - PlayerColor { - cursor: pink().dark().step_9(), - background: pink().dark().step_5(), - selection: pink().dark().step_3(), - }, - PlayerColor { - cursor: lime().dark().step_9(), - background: lime().dark().step_5(), - selection: lime().dark().step_3(), - }, - PlayerColor { - cursor: purple().dark().step_9(), - background: purple().dark().step_5(), - selection: purple().dark().step_3(), - }, - PlayerColor { - cursor: amber().dark().step_9(), - background: amber().dark().step_5(), - selection: amber().dark().step_3(), - }, - PlayerColor { - cursor: jade().dark().step_9(), - background: jade().dark().step_5(), - selection: jade().dark().step_3(), - }, - PlayerColor { - cursor: red().dark().step_9(), - background: red().dark().step_5(), - selection: red().dark().step_3(), - }, - ]) - } - - pub fn light() -> Self { - Self(vec![ - PlayerColor { - cursor: blue().light().step_9(), - background: blue().light().step_4(), - selection: blue().light().step_3(), - }, - PlayerColor { - cursor: orange().light().step_9(), - background: orange().light().step_4(), - selection: orange().light().step_3(), - }, - PlayerColor { - cursor: pink().light().step_9(), - background: pink().light().step_4(), - selection: pink().light().step_3(), - }, - PlayerColor { - cursor: lime().light().step_9(), - background: lime().light().step_4(), - selection: lime().light().step_3(), - }, - PlayerColor { - cursor: purple().light().step_9(), - background: purple().light().step_4(), - selection: purple().light().step_3(), - }, - PlayerColor { - cursor: amber().light().step_9(), - background: amber().light().step_4(), - selection: amber().light().step_3(), - }, - PlayerColor { - cursor: jade().light().step_9(), - background: jade().light().step_4(), - selection: jade().light().step_3(), - }, - PlayerColor { - cursor: red().light().step_9(), - background: red().light().step_4(), - selection: red().light().step_3(), - }, - ]) + default_dark_theme().players().clone() } } diff --git a/crates/theme/src/styles/status.rs b/crates/theme/src/styles/status.rs index ab333ecb3ee2d0be32aa76e99e073fb37873bcf9..eefd127c93da3f83e6d7b57bcadfb793e823859b 100644 --- a/crates/theme/src/styles/status.rs +++ b/crates/theme/src/styles/status.rs @@ -3,7 +3,7 @@ use gpui::Hsla; use refineable::Refineable; -use crate::{blue, grass, neutral, red, yellow}; +use crate::default::default_dark_theme; #[derive(Refineable, Clone, Debug, PartialEq)] #[refineable(Debug, serde::Deserialize)] @@ -80,112 +80,14 @@ pub struct StatusColors { pub warning_border: Hsla, } +impl Default for StatusColors { + fn default() -> Self { + default_dark_theme().status().clone() + } +} + pub struct DiagnosticColors { pub error: Hsla, pub warning: Hsla, pub info: Hsla, } - -impl StatusColors { - pub fn dark() -> Self { - Self { - conflict: red().dark().step_9(), - conflict_background: red().dark().step_9(), - conflict_border: red().dark().step_9(), - created: grass().dark().step_9(), - created_background: grass().dark().step_9().opacity(0.25), - created_border: grass().dark().step_9(), - deleted: red().dark().step_9(), - deleted_background: red().dark().step_9().opacity(0.25), - deleted_border: red().dark().step_9(), - error: red().dark().step_9(), - error_background: red().dark().step_9(), - error_border: red().dark().step_9(), - hidden: neutral().dark().step_9(), - hidden_background: neutral().dark().step_9(), - hidden_border: neutral().dark().step_9(), - hint: blue().dark().step_9(), - hint_background: blue().dark().step_9(), - hint_border: blue().dark().step_9(), - ignored: neutral().dark().step_9(), - ignored_background: neutral().dark().step_9(), - ignored_border: neutral().dark().step_9(), - info: blue().dark().step_9(), - info_background: blue().dark().step_9(), - info_border: blue().dark().step_9(), - modified: yellow().dark().step_9(), - modified_background: yellow().dark().step_9().opacity(0.25), - modified_border: yellow().dark().step_9(), - predictive: neutral().dark_alpha().step_9(), - predictive_background: neutral().dark_alpha().step_9(), - predictive_border: neutral().dark_alpha().step_9(), - renamed: blue().dark().step_9(), - renamed_background: blue().dark().step_9(), - renamed_border: blue().dark().step_9(), - success: grass().dark().step_9(), - success_background: grass().dark().step_9(), - success_border: grass().dark().step_9(), - unreachable: neutral().dark().step_10(), - unreachable_background: neutral().dark().step_10(), - unreachable_border: neutral().dark().step_10(), - warning: yellow().dark().step_9(), - warning_background: yellow().dark().step_9(), - warning_border: yellow().dark().step_9(), - } - } - - pub fn light() -> Self { - Self { - conflict: red().light().step_9(), - conflict_background: red().light().step_9(), - conflict_border: red().light().step_9(), - created: grass().light().step_9(), - created_background: grass().light().step_9(), - created_border: grass().light().step_9(), - deleted: red().light().step_9(), - deleted_background: red().light().step_9(), - deleted_border: red().light().step_9(), - error: red().light().step_9(), - error_background: red().light().step_9(), - error_border: red().light().step_9(), - hidden: neutral().light().step_9(), - hidden_background: neutral().light().step_9(), - hidden_border: neutral().light().step_9(), - hint: blue().light().step_9(), - hint_background: blue().light().step_9(), - hint_border: blue().light().step_9(), - ignored: neutral().light().step_9(), - ignored_background: neutral().light().step_9(), - ignored_border: neutral().light().step_9(), - info: blue().light().step_9(), - info_background: blue().light().step_9(), - info_border: blue().light().step_9(), - modified: yellow().light().step_9(), - modified_background: yellow().light().step_9(), - modified_border: yellow().light().step_9(), - predictive: neutral().light_alpha().step_9(), - predictive_background: neutral().light_alpha().step_9(), - predictive_border: neutral().light_alpha().step_9(), - renamed: blue().light().step_9(), - renamed_background: blue().light().step_9(), - renamed_border: blue().light().step_9(), - success: grass().light().step_9(), - success_background: grass().light().step_9(), - success_border: grass().light().step_9(), - unreachable: neutral().light().step_10(), - unreachable_background: neutral().light().step_10(), - unreachable_border: neutral().light().step_10(), - warning: yellow().light().step_9(), - warning_background: yellow().light().step_9(), - warning_border: yellow().light().step_9(), - } - } - - pub fn diagnostic(&self) -> DiagnosticColors { - DiagnosticColors { - error: self.error, - warning: self.warning, - info: self.info, - } - } -} diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index f04eeade73a55210143ff9f96b865d90af20f6f5..0e1320fd9268ef62bbdcff7d05deda63d1e056a4 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -8,13 +8,11 @@ //! //! A theme is a collection of colors used to build a consistent appearance for UI components across the application. -mod default_colors; -mod fallback_themes; +mod default; mod font_family_cache; mod icon_theme; mod icon_theme_schema; mod registry; -mod scale; mod schema; mod settings; mod styles; @@ -25,7 +23,6 @@ use std::sync::Arc; use ::settings::Settings; use ::settings::SettingsStore; use anyhow::Result; -use fallback_themes::apply_status_color_defaults; use fs::Fs; use gpui::{ App, AssetSource, HighlightStyle, Hsla, Pixels, Refineable, SharedString, WindowAppearance, @@ -34,13 +31,12 @@ use gpui::{ use serde::Deserialize; use uuid::Uuid; -pub use crate::default_colors::*; -use crate::fallback_themes::apply_theme_color_defaults; +use crate::default::default_dark_theme; +use crate::default::default_light_theme; pub use crate::font_family_cache::*; pub use crate::icon_theme::*; pub use crate::icon_theme_schema::*; pub use crate::registry::*; -pub use crate::scale::*; pub use crate::schema::*; pub use crate::settings::*; pub use crate::styles::*; @@ -135,6 +131,39 @@ impl ActiveTheme for App { } } +// If a theme customizes a foreground version of a status color, but does not +// customize the background color, then use a partly-transparent version of the +// foreground color for the background color. +pub(crate) fn apply_status_color_defaults(status: &mut StatusColorsRefinement) { + for (fg_color, bg_color) in [ + (&status.deleted, &mut status.deleted_background), + (&status.created, &mut status.created_background), + (&status.modified, &mut status.modified_background), + (&status.conflict, &mut status.conflict_background), + (&status.error, &mut status.error_background), + (&status.hidden, &mut status.hidden_background), + ] { + if bg_color.is_none() { + if let Some(fg_color) = fg_color { + *bg_color = Some(fg_color.opacity(0.25)); + } + } + } +} + +pub(crate) fn apply_theme_color_defaults( + theme_colors: &mut ThemeColorsRefinement, + player_colors: &PlayerColors, +) { + if theme_colors.element_selection_background.is_none() { + let mut selection = player_colors.local().selection; + if selection.a == 1.0 { + selection.a = 0.25; + } + theme_colors.element_selection_background = Some(selection); + } +} + /// A theme family is a grouping of themes under a single name. /// /// For example, the "One" theme family contains the "One Light" and "One Dark" themes. @@ -151,9 +180,6 @@ pub struct ThemeFamily { pub author: SharedString, /// The [Theme]s in the family. pub themes: Vec, - /// The color scales used by the themes in the family. - /// Note: This will be removed in the future. - pub scales: ColorScales, } impl ThemeFamily { @@ -166,32 +192,28 @@ impl ThemeFamily { AppearanceContent::Dark => Appearance::Dark, }; - let mut refined_status_colors = match theme.appearance { - AppearanceContent::Light => StatusColors::light(), - AppearanceContent::Dark => StatusColors::dark(), + let default_theme = match appearance { + Appearance::Light => default_light_theme(), + Appearance::Dark => default_dark_theme(), }; + + let mut refined_status_colors = default_theme.status().clone(); let mut status_colors_refinement = theme.style.status_colors_refinement(); + apply_status_color_defaults(&mut status_colors_refinement); refined_status_colors.refine(&status_colors_refinement); - let mut refined_player_colors = match theme.appearance { - AppearanceContent::Light => PlayerColors::light(), - AppearanceContent::Dark => PlayerColors::dark(), - }; + let mut refined_player_colors = default_theme.players().clone(); refined_player_colors.merge(&theme.style.players); - let mut refined_theme_colors = match theme.appearance { - AppearanceContent::Light => ThemeColors::light(), - AppearanceContent::Dark => ThemeColors::dark(), - }; + // TODO: + let mut refined_theme_colors = default_theme.colors().clone(); let mut theme_colors_refinement = theme.style.theme_colors_refinement(); + apply_theme_color_defaults(&mut theme_colors_refinement, &refined_player_colors); refined_theme_colors.refine(&theme_colors_refinement); - let mut refined_accent_colors = match theme.appearance { - AppearanceContent::Light => AccentColors::light(), - AppearanceContent::Dark => AccentColors::dark(), - }; + let mut refined_accent_colors = default_theme.accents().clone(); refined_accent_colors.merge(&theme.style.accents); let syntax_highlights = theme @@ -253,7 +275,6 @@ pub fn refine_theme_family(theme_family_content: ThemeFamilyContent) -> ThemeFam name: name.clone().into(), author: author.clone().into(), themes: vec![], - scales: default_color_scales(), }; let refined_themes = theme_family_content diff --git a/crates/workspace/src/theme_preview.rs b/crates/workspace/src/theme_preview.rs index 03164e0a647e01d8805b1186ccddf72acd96da99..d4c77ce6ce409aa234c6b913cd1ab95534c843a7 100644 --- a/crates/workspace/src/theme_preview.rs +++ b/crates/workspace/src/theme_preview.rs @@ -1,7 +1,6 @@ #![allow(unused, dead_code)] use gpui::{AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla, actions, hsla}; use strum::IntoEnumIterator; -use theme::all_theme_colors; use ui::{ AudioStatus, Avatar, AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, Checkbox, CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, @@ -281,56 +280,6 @@ impl ThemePreview { ) } - fn render_colors( - &self, - layer: ElevationIndex, - window: &mut Window, - cx: &mut Context, - ) -> impl IntoElement { - let bg = layer.bg(cx); - let all_colors = all_theme_colors(cx); - - v_flex() - .gap_1() - .child( - Headline::new("Colors") - .size(HeadlineSize::Small) - .color(Color::Muted), - ) - .child( - h_flex() - .flex_wrap() - .gap_1() - .children(all_colors.into_iter().map(|(color, name)| { - let id = ElementId::Name(format!("{:?}-preview", color).into()); - let name = name.clone(); - div().size_8().flex_none().child( - ButtonLike::new(id) - .child( - div() - .size_8() - .bg(color) - .border_1() - .border_color(cx.theme().colors().border) - .overflow_hidden(), - ) - .size(ButtonSize::None) - .style(ButtonStyle::Transparent) - .tooltip(move |window, cx| { - let name = name.clone(); - Tooltip::with_meta( - name, - None, - format!("{:?}", color), - window, - cx, - ) - }), - ) - })), - ) - } - fn render_theme_layer( &self, layer: ElevationIndex, @@ -344,7 +293,6 @@ impl ThemePreview { .gap_2() .child(Headline::new(layer.clone().to_string()).size(HeadlineSize::Medium)) .child(self.render_text(layer, window, cx)) - .child(self.render_colors(layer, window, cx)) } fn render_overview_page(