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                search_match_background: bg, // todo!(this was inserted by Mikayla)
 79
 80                editor_background: editor,
 81                editor_gutter_background: editor,
 82                editor_subheader_background: bg,
 83                editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
 84                editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
 85                editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
 86                editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
 87                editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
 88                editor_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
 89                editor_active_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
 90                editor_document_highlight_read_background: hsla(
 91                    207.8 / 360.,
 92                    81. / 100.,
 93                    66. / 100.,
 94                    0.2,
 95                ),
 96                editor_document_highlight_write_background: gpui::red(),
 97
 98                terminal_background: bg,
 99                // todo!("Use one colors for terminal")
100                terminal_ansi_black: crate::black().dark().step_12(),
101                terminal_ansi_red: crate::red().dark().step_11(),
102                terminal_ansi_green: crate::green().dark().step_11(),
103                terminal_ansi_yellow: crate::yellow().dark().step_11(),
104                terminal_ansi_blue: crate::blue().dark().step_11(),
105                terminal_ansi_magenta: crate::violet().dark().step_11(),
106                terminal_ansi_cyan: crate::cyan().dark().step_11(),
107                terminal_ansi_white: crate::neutral().dark().step_12(),
108                terminal_ansi_bright_black: crate::black().dark().step_11(),
109                terminal_ansi_bright_red: crate::red().dark().step_10(),
110                terminal_ansi_bright_green: crate::green().dark().step_10(),
111                terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
112                terminal_ansi_bright_blue: crate::blue().dark().step_10(),
113                terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
114                terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
115                terminal_ansi_bright_white: crate::neutral().dark().step_11(),
116                panel_background: bg,
117                panel_focused_border: blue,
118                pane_focused_border: blue,
119                scrollbar_thumb_background: gpui::transparent_black(),
120                scrollbar_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
121                scrollbar_thumb_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
122                scrollbar_track_background: gpui::transparent_black(),
123                scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
124                editor_foreground: hsla(218. / 360., 14. / 100., 71. / 100., 1.),
125                link_text_hover: blue,
126            },
127            status: StatusColors {
128                conflict: yellow,
129                conflict_background: yellow,
130                conflict_border: yellow,
131                created: green,
132                created_background: green,
133                created_border: green,
134                deleted: red,
135                deleted_background: red,
136                deleted_border: red,
137                error: red,
138                error_background: red,
139                error_border: red,
140                hidden: gray,
141                hidden_background: gray,
142                hidden_border: gray,
143                hint: blue,
144                hint_background: blue,
145                hint_border: blue,
146                ignored: gray,
147                ignored_background: gray,
148                ignored_border: gray,
149                info: blue,
150                info_background: blue,
151                info_border: blue,
152                modified: yellow,
153                modified_background: yellow,
154                modified_border: yellow,
155                predictive: gray,
156                predictive_background: gray,
157                predictive_border: gray,
158                renamed: blue,
159                renamed_background: blue,
160                renamed_border: blue,
161                success: green,
162                success_background: green,
163                success_border: green,
164                unreachable: gray,
165                unreachable_background: gray,
166                unreachable_border: gray,
167                warning: yellow,
168                warning_background: yellow,
169                warning_border: yellow,
170            },
171            player: PlayerColors::dark(),
172            syntax: Arc::new(SyntaxTheme {
173                highlights: vec![
174                    ("attribute".into(), purple.into()),
175                    ("boolean".into(), orange.into()),
176                    ("comment".into(), gray.into()),
177                    ("comment.doc".into(), gray.into()),
178                    ("constant".into(), yellow.into()),
179                    ("constructor".into(), blue.into()),
180                    ("embedded".into(), HighlightStyle::default()),
181                    (
182                        "emphasis".into(),
183                        HighlightStyle {
184                            font_style: Some(FontStyle::Italic),
185                            ..HighlightStyle::default()
186                        },
187                    ),
188                    (
189                        "emphasis.strong".into(),
190                        HighlightStyle {
191                            font_weight: Some(FontWeight::BOLD),
192                            ..HighlightStyle::default()
193                        },
194                    ),
195                    ("enum".into(), HighlightStyle::default()),
196                    ("function".into(), blue.into()),
197                    ("function.method".into(), blue.into()),
198                    ("function.definition".into(), blue.into()),
199                    ("hint".into(), blue.into()),
200                    ("keyword".into(), purple.into()),
201                    ("label".into(), HighlightStyle::default()),
202                    ("link_text".into(), blue.into()),
203                    (
204                        "link_uri".into(),
205                        HighlightStyle {
206                            color: Some(teal.into()),
207                            font_style: Some(FontStyle::Italic),
208                            ..HighlightStyle::default()
209                        },
210                    ),
211                    ("number".into(), orange.into()),
212                    ("operator".into(), HighlightStyle::default()),
213                    ("predictive".into(), HighlightStyle::default()),
214                    ("preproc".into(), HighlightStyle::default()),
215                    ("primary".into(), HighlightStyle::default()),
216                    ("property".into(), red.into()),
217                    ("punctuation".into(), HighlightStyle::default()),
218                    ("punctuation.bracket".into(), HighlightStyle::default()),
219                    ("punctuation.delimiter".into(), HighlightStyle::default()),
220                    ("punctuation.list_marker".into(), HighlightStyle::default()),
221                    ("punctuation.special".into(), HighlightStyle::default()),
222                    ("string".into(), green.into()),
223                    ("string.escape".into(), HighlightStyle::default()),
224                    ("string.regex".into(), red.into()),
225                    ("string.special".into(), HighlightStyle::default()),
226                    ("string.special.symbol".into(), HighlightStyle::default()),
227                    ("tag".into(), HighlightStyle::default()),
228                    ("text.literal".into(), HighlightStyle::default()),
229                    ("title".into(), HighlightStyle::default()),
230                    ("type".into(), teal.into()),
231                    ("variable".into(), HighlightStyle::default()),
232                    ("variable.special".into(), red.into()),
233                    ("variant".into(), HighlightStyle::default()),
234                ],
235            }),
236            accents: vec![blue, orange, purple, teal],
237        },
238    }
239}