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(), 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(), 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<StaticColorScaleSet> for ColorScaleSet { type Error = anyhow::Error; fn try_from(value: StaticColorScaleSet) -> Result<Self, Self::Error> { fn to_color_scale(scale: StaticColorScale) -> anyhow::Result<ColorScale> { scale .into_iter() .map(|color| Rgba::try_from(color).map(Hsla::from)) .collect::<Result<Vec<_>, _>>() .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",Lines 1–500 of 2460. Load more
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(), 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(), 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<StaticColorScaleSet> for ColorScaleSet { type Error = anyhow::Error; fn try_from(value: StaticColorScaleSet) -> Result<Self, Self::Error> { fn to_color_scale(scale: StaticColorScale) -> anyhow::Result<ColorScale> { scale .into_iter() .map(|color| Rgba::try_from(color).map(Hsla::from)) .collect::<Result<Vec<_>, _>>() .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",