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                created: green,
130                deleted: red,
131                error: red,
132                hidden: gray,
133                hint: blue,
134                ignored: gray,
135                info: blue,
136                modified: yellow,
137                predictive: gray,
138                renamed: blue,
139                success: green,
140                unreachable: gray,
141                warning: yellow,
142            },
143            player: PlayerColors::dark(),
144            syntax: Arc::new(SyntaxTheme {
145                highlights: vec![
146                    ("attribute".into(), purple.into()),
147                    ("boolean".into(), orange.into()),
148                    ("comment".into(), gray.into()),
149                    ("comment.doc".into(), gray.into()),
150                    ("constant".into(), yellow.into()),
151                    ("constructor".into(), blue.into()),
152                    ("embedded".into(), HighlightStyle::default()),
153                    (
154                        "emphasis".into(),
155                        HighlightStyle {
156                            font_style: Some(FontStyle::Italic),
157                            ..HighlightStyle::default()
158                        },
159                    ),
160                    (
161                        "emphasis.strong".into(),
162                        HighlightStyle {
163                            font_weight: Some(FontWeight::BOLD),
164                            ..HighlightStyle::default()
165                        },
166                    ),
167                    ("enum".into(), HighlightStyle::default()),
168                    ("function".into(), blue.into()),
169                    ("function.method".into(), blue.into()),
170                    ("function.definition".into(), blue.into()),
171                    ("hint".into(), blue.into()),
172                    ("keyword".into(), purple.into()),
173                    ("label".into(), HighlightStyle::default()),
174                    ("link_text".into(), blue.into()),
175                    (
176                        "link_uri".into(),
177                        HighlightStyle {
178                            color: Some(teal.into()),
179                            font_style: Some(FontStyle::Italic),
180                            ..HighlightStyle::default()
181                        },
182                    ),
183                    ("number".into(), orange.into()),
184                    ("operator".into(), HighlightStyle::default()),
185                    ("predictive".into(), HighlightStyle::default()),
186                    ("preproc".into(), HighlightStyle::default()),
187                    ("primary".into(), HighlightStyle::default()),
188                    ("property".into(), red.into()),
189                    ("punctuation".into(), HighlightStyle::default()),
190                    ("punctuation.bracket".into(), HighlightStyle::default()),
191                    ("punctuation.delimiter".into(), HighlightStyle::default()),
192                    ("punctuation.list_marker".into(), HighlightStyle::default()),
193                    ("punctuation.special".into(), HighlightStyle::default()),
194                    ("string".into(), green.into()),
195                    ("string.escape".into(), HighlightStyle::default()),
196                    ("string.regex".into(), red.into()),
197                    ("string.special".into(), HighlightStyle::default()),
198                    ("string.special.symbol".into(), HighlightStyle::default()),
199                    ("tag".into(), HighlightStyle::default()),
200                    ("text.literal".into(), HighlightStyle::default()),
201                    ("title".into(), HighlightStyle::default()),
202                    ("type".into(), teal.into()),
203                    ("variable".into(), HighlightStyle::default()),
204                    ("variable.special".into(), red.into()),
205                    ("variant".into(), HighlightStyle::default()),
206                ],
207            }),
208            accents: vec![blue, orange, purple, teal],
209        },
210    }
211}