one_themes.rs

  1use std::sync::Arc;
  2
  3use gpui::{hsla, FontStyle, FontWeight, HighlightStyle};
  4
  5use crate::{
  6    default_color_scales, Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme,
  7    ThemeColors, ThemeFamily, ThemeStyles,
  8};
  9
 10pub fn one_family() -> ThemeFamily {
 11    ThemeFamily {
 12        id: "one".to_string(),
 13        name: "One".into(),
 14        author: "".into(),
 15        themes: vec![one_dark()],
 16        scales: default_color_scales(),
 17    }
 18}
 19
 20pub(crate) fn one_dark() -> Theme {
 21    let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.);
 22    let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
 23    let elevated_surface = hsla(225. / 360., 12. / 100., 17. / 100., 1.);
 24
 25    let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0);
 26    let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
 27    let green = hsla(95. / 360., 38. / 100., 62. / 100., 1.0);
 28    let orange = hsla(29. / 360., 54. / 100., 61. / 100., 1.0);
 29    let purple = hsla(286. / 360., 51. / 100., 64. / 100., 1.0);
 30    let red = hsla(355. / 360., 65. / 100., 65. / 100., 1.0);
 31    let teal = hsla(187. / 360., 47. / 100., 55. / 100., 1.0);
 32    let yellow = hsla(39. / 360., 67. / 100., 69. / 100., 1.0);
 33
 34    Theme {
 35        id: "one_dark".to_string(),
 36        name: "One Dark".into(),
 37        appearance: Appearance::Dark,
 38
 39        styles: ThemeStyles {
 40            system: SystemColors::default(),
 41            colors: ThemeColors {
 42                border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
 43                border_variant: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
 44                border_focused: hsla(223. / 360., 78. / 100., 65. / 100., 1.),
 45                border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
 46                border_transparent: SystemColors::default().transparent,
 47                border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
 48                elevated_surface_background: elevated_surface,
 49                surface_background: bg,
 50                background: bg,
 51                element_background: hsla(223.0 / 360., 13. / 100., 21. / 100., 1.0),
 52                element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
 53                element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
 54                element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
 55                element_disabled: SystemColors::default().transparent,
 56                drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0),
 57                ghost_element_background: SystemColors::default().transparent,
 58                ghost_element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
 59                ghost_element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
 60                ghost_element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
 61                ghost_element_disabled: SystemColors::default().transparent,
 62                text: hsla(221. / 360., 11. / 100., 86. / 100., 1.0),
 63                text_muted: hsla(218.0 / 360., 7. / 100., 46. / 100., 1.0),
 64                text_placeholder: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
 65                text_disabled: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
 66                text_accent: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
 67                icon: hsla(222.9 / 360., 9.9 / 100., 86.1 / 100., 1.0),
 68                icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
 69                icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
 70                icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
 71                icon_accent: blue.into(),
 72                status_bar_background: bg,
 73                title_bar_background: bg,
 74                toolbar_background: editor,
 75                tab_bar_background: bg,
 76                tab_inactive_background: bg,
 77                tab_active_background: editor,
 78                editor_background: editor,
 79                editor_gutter_background: editor,
 80                editor_subheader_background: bg,
 81                editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
 82                editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
 83                editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
 84                editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
 85                editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
 86                editor_wrap_guide: gpui::black(),
 87                editor_active_wrap_guide: gpui::red(),
 88                editor_document_highlight_read_background: hsla(
 89                    207.8 / 360.,
 90                    81. / 100.,
 91                    66. / 100.,
 92                    0.2,
 93                ),
 94                editor_document_highlight_write_background: gpui::red(),
 95                terminal_background: bg,
 96                // todo!("Use one colors for terminal")
 97                terminal_ansi_black: crate::black().dark().step_12(),
 98                terminal_ansi_red: crate::red().dark().step_11(),
 99                terminal_ansi_green: crate::green().dark().step_11(),
100                terminal_ansi_yellow: crate::yellow().dark().step_11(),
101                terminal_ansi_blue: crate::blue().dark().step_11(),
102                terminal_ansi_magenta: crate::violet().dark().step_11(),
103                terminal_ansi_cyan: crate::cyan().dark().step_11(),
104                terminal_ansi_white: crate::neutral().dark().step_12(),
105                terminal_ansi_bright_black: crate::black().dark().step_11(),
106                terminal_ansi_bright_red: crate::red().dark().step_10(),
107                terminal_ansi_bright_green: crate::green().dark().step_10(),
108                terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
109                terminal_ansi_bright_blue: crate::blue().dark().step_10(),
110                terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
111                terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
112                terminal_ansi_bright_white: crate::neutral().dark().step_11(),
113            },
114            status: StatusColors {
115                conflict: yellow,
116                created: green,
117                deleted: red,
118                error: red,
119                hidden: gray,
120                hint: blue,
121                ignored: gray,
122                info: blue,
123                modified: yellow,
124                predictive: gray,
125                renamed: blue,
126                success: green,
127                unreachable: gray,
128                warning: yellow,
129            },
130            player: PlayerColors::dark(),
131            syntax: Arc::new(SyntaxTheme {
132                highlights: vec![
133                    ("attribute".into(), purple.into()),
134                    ("boolean".into(), orange.into()),
135                    ("comment".into(), gray.into()),
136                    ("comment.doc".into(), gray.into()),
137                    ("constant".into(), yellow.into()),
138                    ("constructor".into(), blue.into()),
139                    ("embedded".into(), HighlightStyle::default()),
140                    (
141                        "emphasis".into(),
142                        HighlightStyle {
143                            font_style: Some(FontStyle::Italic),
144                            ..HighlightStyle::default()
145                        },
146                    ),
147                    (
148                        "emphasis.strong".into(),
149                        HighlightStyle {
150                            font_weight: Some(FontWeight::BOLD),
151                            ..HighlightStyle::default()
152                        },
153                    ),
154                    ("enum".into(), HighlightStyle::default()),
155                    ("function".into(), blue.into()),
156                    ("function.method".into(), blue.into()),
157                    ("function.definition".into(), blue.into()),
158                    ("hint".into(), blue.into()),
159                    ("keyword".into(), purple.into()),
160                    ("label".into(), HighlightStyle::default()),
161                    ("link_text".into(), blue.into()),
162                    (
163                        "link_uri".into(),
164                        HighlightStyle {
165                            color: Some(teal.into()),
166                            font_style: Some(FontStyle::Italic),
167                            ..HighlightStyle::default()
168                        },
169                    ),
170                    ("number".into(), orange.into()),
171                    ("operator".into(), HighlightStyle::default()),
172                    ("predictive".into(), HighlightStyle::default()),
173                    ("preproc".into(), HighlightStyle::default()),
174                    ("primary".into(), HighlightStyle::default()),
175                    ("property".into(), red.into()),
176                    ("punctuation".into(), HighlightStyle::default()),
177                    ("punctuation.bracket".into(), HighlightStyle::default()),
178                    ("punctuation.delimiter".into(), HighlightStyle::default()),
179                    ("punctuation.list_marker".into(), HighlightStyle::default()),
180                    ("punctuation.special".into(), HighlightStyle::default()),
181                    ("string".into(), green.into()),
182                    ("string.escape".into(), HighlightStyle::default()),
183                    ("string.regex".into(), red.into()),
184                    ("string.special".into(), HighlightStyle::default()),
185                    ("string.special.symbol".into(), HighlightStyle::default()),
186                    ("tag".into(), HighlightStyle::default()),
187                    ("text.literal".into(), HighlightStyle::default()),
188                    ("title".into(), HighlightStyle::default()),
189                    ("type".into(), teal.into()),
190                    ("variable".into(), HighlightStyle::default()),
191                    ("variable.special".into(), red.into()),
192                    ("variant".into(), HighlightStyle::default()),
193                ],
194                inlay_style: HighlightStyle::default(),
195                suggestion_style: HighlightStyle::default(),
196            }),
197        },
198    }
199}