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