1use std::sync::Arc;
2
3use gpui::{hsla, FontStyle, FontWeight, HighlightStyle, WindowBackgroundAppearance};
4
5use crate::{
6 default_color_scales, Appearance, PlayerColors, StatusColors, SyntaxTheme, SystemColors, Theme,
7 ThemeColors, ThemeFamily, ThemeStyles,
8};
9
10// Note: This theme family is not the one you see in Zed at the moment.
11// This is a from-scratch rebuild that Nate started work on. We currently
12// only use this in the tests, and the One family from the `themes/` directory
13// is what gets loaded into Zed when running it.
14pub fn one_family() -> ThemeFamily {
15 ThemeFamily {
16 id: "one".to_string(),
17 name: "One".into(),
18 author: "".into(),
19 themes: vec![one_dark()],
20 scales: default_color_scales(),
21 }
22}
23
24pub(crate) fn one_dark() -> Theme {
25 let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.);
26 let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
27 let elevated_surface = hsla(225. / 360., 12. / 100., 17. / 100., 1.);
28
29 let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0);
30 let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
31 let green = hsla(95. / 360., 38. / 100., 62. / 100., 1.0);
32 let orange = hsla(29. / 360., 54. / 100., 61. / 100., 1.0);
33 let purple = hsla(286. / 360., 51. / 100., 64. / 100., 1.0);
34 let red = hsla(355. / 360., 65. / 100., 65. / 100., 1.0);
35 let teal = hsla(187. / 360., 47. / 100., 55. / 100., 1.0);
36 let yellow = hsla(39. / 360., 67. / 100., 69. / 100., 1.0);
37
38 Theme {
39 id: "one_dark".to_string(),
40 name: "One Dark".into(),
41 appearance: Appearance::Dark,
42 styles: ThemeStyles {
43 window_background_appearance: WindowBackgroundAppearance::Opaque,
44 system: SystemColors::default(),
45 colors: ThemeColors {
46 border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
47 border_variant: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
48 border_focused: hsla(223. / 360., 78. / 100., 65. / 100., 1.),
49 border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
50 border_transparent: SystemColors::default().transparent,
51 border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
52 elevated_surface_background: elevated_surface,
53 surface_background: bg,
54 background: bg,
55 element_background: hsla(223.0 / 360., 13. / 100., 21. / 100., 1.0),
56 element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
57 element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
58 element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
59 element_disabled: SystemColors::default().transparent,
60 drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0),
61 ghost_element_background: SystemColors::default().transparent,
62 ghost_element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
63 ghost_element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
64 ghost_element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
65 ghost_element_disabled: SystemColors::default().transparent,
66 text: hsla(221. / 360., 11. / 100., 86. / 100., 1.0),
67 text_muted: hsla(218.0 / 360., 7. / 100., 46. / 100., 1.0),
68 text_placeholder: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
69 text_disabled: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
70 text_accent: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
71 icon: hsla(222.9 / 360., 9.9 / 100., 86.1 / 100., 1.0),
72 icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
73 icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
74 icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
75 icon_accent: blue,
76 status_bar_background: bg,
77 title_bar_background: bg,
78 toolbar_background: editor,
79 tab_bar_background: bg,
80 tab_inactive_background: bg,
81 tab_active_background: editor,
82 search_match_background: bg,
83
84 editor_background: editor,
85 editor_gutter_background: editor,
86 editor_subheader_background: bg,
87 editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
88 editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
89 editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
90 editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
91 editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
92 editor_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
93 editor_active_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
94 editor_document_highlight_read_background: hsla(
95 207.8 / 360.,
96 81. / 100.,
97 66. / 100.,
98 0.2,
99 ),
100 editor_document_highlight_write_background: gpui::red(),
101
102 terminal_background: bg,
103 // todo("Use one colors for terminal")
104 terminal_foreground: crate::white().dark().step_12(),
105 terminal_bright_foreground: crate::white().dark().step_11(),
106 terminal_dim_foreground: crate::white().dark().step_10(),
107 terminal_ansi_black: crate::black().dark().step_12(),
108 terminal_ansi_red: crate::red().dark().step_11(),
109 terminal_ansi_green: crate::green().dark().step_11(),
110 terminal_ansi_yellow: crate::yellow().dark().step_11(),
111 terminal_ansi_blue: crate::blue().dark().step_11(),
112 terminal_ansi_magenta: crate::violet().dark().step_11(),
113 terminal_ansi_cyan: crate::cyan().dark().step_11(),
114 terminal_ansi_white: crate::neutral().dark().step_12(),
115 terminal_ansi_bright_black: crate::black().dark().step_11(),
116 terminal_ansi_bright_red: crate::red().dark().step_10(),
117 terminal_ansi_bright_green: crate::green().dark().step_10(),
118 terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
119 terminal_ansi_bright_blue: crate::blue().dark().step_10(),
120 terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
121 terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
122 terminal_ansi_bright_white: crate::neutral().dark().step_11(),
123 terminal_ansi_dim_black: crate::black().dark().step_10(),
124 terminal_ansi_dim_red: crate::red().dark().step_9(),
125 terminal_ansi_dim_green: crate::green().dark().step_9(),
126 terminal_ansi_dim_yellow: crate::yellow().dark().step_9(),
127 terminal_ansi_dim_blue: crate::blue().dark().step_9(),
128 terminal_ansi_dim_magenta: crate::violet().dark().step_9(),
129 terminal_ansi_dim_cyan: crate::cyan().dark().step_9(),
130 terminal_ansi_dim_white: crate::neutral().dark().step_10(),
131 panel_background: bg,
132 panel_focused_border: blue,
133 pane_focused_border: blue,
134 pane_group_border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
135 scrollbar_thumb_background: gpui::transparent_black(),
136 scrollbar_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
137 scrollbar_thumb_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
138 scrollbar_track_background: gpui::transparent_black(),
139 scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
140 editor_foreground: hsla(218. / 360., 14. / 100., 71. / 100., 1.),
141 link_text_hover: blue,
142 },
143 status: StatusColors {
144 conflict: yellow,
145 conflict_background: yellow,
146 conflict_border: yellow,
147 created: green,
148 created_background: green,
149 created_border: green,
150 deleted: red,
151 deleted_background: red,
152 deleted_border: red,
153 error: red,
154 error_background: red,
155 error_border: red,
156 hidden: gray,
157 hidden_background: gray,
158 hidden_border: gray,
159 hint: blue,
160 hint_background: blue,
161 hint_border: blue,
162 ignored: gray,
163 ignored_background: gray,
164 ignored_border: gray,
165 info: blue,
166 info_background: blue,
167 info_border: blue,
168 modified: yellow,
169 modified_background: yellow,
170 modified_border: yellow,
171 predictive: gray,
172 predictive_background: gray,
173 predictive_border: gray,
174 renamed: blue,
175 renamed_background: blue,
176 renamed_border: blue,
177 success: green,
178 success_background: green,
179 success_border: green,
180 unreachable: gray,
181 unreachable_background: gray,
182 unreachable_border: gray,
183 warning: yellow,
184 warning_background: yellow,
185 warning_border: yellow,
186 },
187 player: PlayerColors::dark(),
188 syntax: Arc::new(SyntaxTheme {
189 highlights: vec![
190 ("attribute".into(), purple.into()),
191 ("boolean".into(), orange.into()),
192 ("comment".into(), gray.into()),
193 ("comment.doc".into(), gray.into()),
194 ("constant".into(), yellow.into()),
195 ("constructor".into(), blue.into()),
196 ("embedded".into(), HighlightStyle::default()),
197 (
198 "emphasis".into(),
199 HighlightStyle {
200 font_style: Some(FontStyle::Italic),
201 ..HighlightStyle::default()
202 },
203 ),
204 (
205 "emphasis.strong".into(),
206 HighlightStyle {
207 font_weight: Some(FontWeight::BOLD),
208 ..HighlightStyle::default()
209 },
210 ),
211 ("enum".into(), HighlightStyle::default()),
212 ("function".into(), blue.into()),
213 ("function.method".into(), blue.into()),
214 ("function.definition".into(), blue.into()),
215 ("hint".into(), blue.into()),
216 ("keyword".into(), purple.into()),
217 ("label".into(), HighlightStyle::default()),
218 ("link_text".into(), blue.into()),
219 (
220 "link_uri".into(),
221 HighlightStyle {
222 color: Some(teal),
223 font_style: Some(FontStyle::Italic),
224 ..HighlightStyle::default()
225 },
226 ),
227 ("number".into(), orange.into()),
228 ("operator".into(), HighlightStyle::default()),
229 ("predictive".into(), HighlightStyle::default()),
230 ("preproc".into(), HighlightStyle::default()),
231 ("primary".into(), HighlightStyle::default()),
232 ("property".into(), red.into()),
233 ("punctuation".into(), HighlightStyle::default()),
234 ("punctuation.bracket".into(), HighlightStyle::default()),
235 ("punctuation.delimiter".into(), HighlightStyle::default()),
236 ("punctuation.list_marker".into(), HighlightStyle::default()),
237 ("punctuation.special".into(), HighlightStyle::default()),
238 ("string".into(), green.into()),
239 ("string.escape".into(), HighlightStyle::default()),
240 ("string.regex".into(), red.into()),
241 ("string.special".into(), HighlightStyle::default()),
242 ("string.special.symbol".into(), HighlightStyle::default()),
243 ("tag".into(), HighlightStyle::default()),
244 ("text.literal".into(), HighlightStyle::default()),
245 ("title".into(), HighlightStyle::default()),
246 ("type".into(), teal.into()),
247 ("variable".into(), HighlightStyle::default()),
248 ("variable.special".into(), red.into()),
249 ("variant".into(), HighlightStyle::default()),
250 ],
251 }),
252 accents: vec![blue, orange, purple, teal],
253 },
254 }
255}