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