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