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 light_gray = hsla(218.8 / 360., 14. / 100., 71. / 100., 1.0);
27 let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
28 let green = hsla(95. / 360., 38. / 100., 62. / 100., 1.0);
29 let orange = hsla(29. / 360., 54. / 100., 61. / 100., 1.0);
30 let purple = hsla(286. / 360., 51. / 100., 64. / 100., 1.0);
31 let red = hsla(355. / 360., 65. / 100., 65. / 100., 1.0);
32 let teal = hsla(187. / 360., 47. / 100., 55. / 100., 1.0);
33 let yellow = hsla(39. / 360., 67. / 100., 69. / 100., 1.0);
34
35 Theme {
36 id: "one_dark".to_string(),
37 name: "One Dark".into(),
38 appearance: Appearance::Dark,
39
40 styles: ThemeStyles {
41 system: SystemColors::default(),
42 colors: ThemeColors {
43 border: hsla(225. / 360., 13. / 100., 12. / 100., 1.),
44 border_variant: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
45 border_focused: hsla(223. / 360., 78. / 100., 65. / 100., 1.),
46 border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
47 border_transparent: SystemColors::default().transparent,
48 border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
49 elevated_surface_background: elevated_surface,
50 surface_background: bg,
51 background: bg,
52 element_background: hsla(223.0 / 360., 13. / 100., 21. / 100., 1.0),
53 element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
54 element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
55 element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
56 element_disabled: SystemColors::default().transparent,
57 drop_target_background: hsla(220.0 / 360., 8.3 / 100., 21.4 / 100., 1.0),
58 ghost_element_background: SystemColors::default().transparent,
59 ghost_element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
60 ghost_element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
61 ghost_element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),
62 ghost_element_disabled: SystemColors::default().transparent,
63 text: hsla(221. / 360., 11. / 100., 86. / 100., 1.0),
64 text_muted: hsla(218.0 / 360., 7. / 100., 46. / 100., 1.0),
65 text_placeholder: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
66 text_disabled: hsla(220.0 / 360., 6.6 / 100., 44.5 / 100., 1.0),
67 text_accent: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
68 icon: hsla(222.9 / 360., 9.9 / 100., 86.1 / 100., 1.0),
69 icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
70 icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
71 icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
72 icon_accent: blue.into(),
73 status_bar_background: bg,
74 title_bar_background: bg,
75 toolbar_background: editor,
76 tab_bar_background: bg,
77 tab_inactive_background: bg,
78 tab_active_background: editor,
79 search_match_background: bg, // todo!(this was inserted by Mikayla)
80
81 editor_background: editor,
82 editor_gutter_background: editor,
83 editor_subheader_background: bg,
84 editor_active_line_background: hsla(222.9 / 360., 13.5 / 100., 20.4 / 100., 1.0),
85 editor_highlighted_line_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.1),
86 editor_line_number: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
87 editor_active_line_number: hsla(216.0 / 360., 5.9 / 100., 49.6 / 100., 1.0),
88 editor_invisible: hsla(222.0 / 360., 11.5 / 100., 34.1 / 100., 1.0),
89 editor_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
90 editor_active_wrap_guide: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
91 editor_document_highlight_read_background: hsla(
92 207.8 / 360.,
93 81. / 100.,
94 66. / 100.,
95 0.2,
96 ),
97 editor_document_highlight_write_background: gpui::red(),
98
99 terminal_background: bg,
100 // todo!("Use one colors for terminal")
101 terminal_ansi_black: crate::black().dark().step_12(),
102 terminal_ansi_red: crate::red().dark().step_11(),
103 terminal_ansi_green: crate::green().dark().step_11(),
104 terminal_ansi_yellow: crate::yellow().dark().step_11(),
105 terminal_ansi_blue: crate::blue().dark().step_11(),
106 terminal_ansi_magenta: crate::violet().dark().step_11(),
107 terminal_ansi_cyan: crate::cyan().dark().step_11(),
108 terminal_ansi_white: crate::neutral().dark().step_12(),
109 terminal_ansi_bright_black: crate::black().dark().step_11(),
110 terminal_ansi_bright_red: crate::red().dark().step_10(),
111 terminal_ansi_bright_green: crate::green().dark().step_10(),
112 terminal_ansi_bright_yellow: crate::yellow().dark().step_10(),
113 terminal_ansi_bright_blue: crate::blue().dark().step_10(),
114 terminal_ansi_bright_magenta: crate::violet().dark().step_10(),
115 terminal_ansi_bright_cyan: crate::cyan().dark().step_10(),
116 terminal_ansi_bright_white: crate::neutral().dark().step_11(),
117 panel_background: bg,
118 panel_focused_border: blue,
119 pane_focused_border: blue,
120 scrollbar_thumb_background: gpui::transparent_black(),
121 scrollbar_thumb_hover_background: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
122 scrollbar_thumb_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
123 scrollbar_track_background: gpui::transparent_black(),
124 scrollbar_track_border: hsla(228. / 360., 8. / 100., 25. / 100., 1.),
125 editor_foreground: hsla(218. / 360., 14. / 100., 71. / 100., 1.),
126 headline: hsla(355. / 360., 65. / 100., 65. / 100., 1.),
127 paragraph: light_gray,
128 link_text: blue,
129 link_text_hover: blue,
130 link_uri: teal,
131 inline_code_background: gpui::transparent_black(),
132 inline_code_border: gpui::transparent_black(),
133 code_block_background: gpui::transparent_black(),
134 code_block_border: gpui::transparent_black(),
135 emphasis: orange,
136 },
137 status: StatusColors {
138 conflict: yellow,
139 created: green,
140 deleted: red,
141 error: red,
142 hidden: gray,
143 hint: blue,
144 ignored: gray,
145 info: blue,
146 modified: yellow,
147 predictive: gray,
148 renamed: blue,
149 success: green,
150 unreachable: gray,
151 warning: yellow,
152 },
153 player: PlayerColors::dark(),
154 syntax: Arc::new(SyntaxTheme {
155 highlights: vec![
156 ("attribute".into(), purple.into()),
157 ("boolean".into(), orange.into()),
158 ("comment".into(), gray.into()),
159 ("comment.doc".into(), gray.into()),
160 ("constant".into(), yellow.into()),
161 ("constructor".into(), blue.into()),
162 ("embedded".into(), HighlightStyle::default()),
163 (
164 "emphasis".into(),
165 HighlightStyle {
166 font_style: Some(FontStyle::Italic),
167 ..HighlightStyle::default()
168 },
169 ),
170 (
171 "emphasis.strong".into(),
172 HighlightStyle {
173 font_weight: Some(FontWeight::BOLD),
174 ..HighlightStyle::default()
175 },
176 ),
177 ("enum".into(), HighlightStyle::default()),
178 ("function".into(), blue.into()),
179 ("function.method".into(), blue.into()),
180 ("function.definition".into(), blue.into()),
181 ("hint".into(), blue.into()),
182 ("keyword".into(), purple.into()),
183 ("label".into(), HighlightStyle::default()),
184 ("link_text".into(), blue.into()),
185 (
186 "link_uri".into(),
187 HighlightStyle {
188 color: Some(teal.into()),
189 font_style: Some(FontStyle::Italic),
190 ..HighlightStyle::default()
191 },
192 ),
193 ("number".into(), orange.into()),
194 ("operator".into(), HighlightStyle::default()),
195 ("predictive".into(), HighlightStyle::default()),
196 ("preproc".into(), HighlightStyle::default()),
197 ("primary".into(), HighlightStyle::default()),
198 ("property".into(), red.into()),
199 ("punctuation".into(), HighlightStyle::default()),
200 ("punctuation.bracket".into(), HighlightStyle::default()),
201 ("punctuation.delimiter".into(), HighlightStyle::default()),
202 ("punctuation.list_marker".into(), HighlightStyle::default()),
203 ("punctuation.special".into(), HighlightStyle::default()),
204 ("string".into(), green.into()),
205 ("string.escape".into(), HighlightStyle::default()),
206 ("string.regex".into(), red.into()),
207 ("string.special".into(), HighlightStyle::default()),
208 ("string.special.symbol".into(), HighlightStyle::default()),
209 ("tag".into(), HighlightStyle::default()),
210 ("text.literal".into(), HighlightStyle::default()),
211 ("title".into(), HighlightStyle::default()),
212 ("type".into(), teal.into()),
213 ("variable".into(), HighlightStyle::default()),
214 ("variable.special".into(), red.into()),
215 ("variant".into(), HighlightStyle::default()),
216 ],
217 }),
218 accents: vec![blue, orange, purple, teal],
219 },
220 }
221}