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