1mod theme_registry;
2
3use gpui::{
4 color::Color,
5 elements::{ContainerStyle, ImageStyle, LabelStyle, Shadow, TooltipStyle},
6 fonts::{HighlightStyle, TextStyle},
7 Border, MouseState,
8};
9use serde::{de::DeserializeOwned, Deserialize};
10use serde_json::Value;
11use std::{collections::HashMap, sync::Arc};
12
13pub use theme_registry::*;
14
15#[derive(Deserialize, Default)]
16pub struct Theme {
17 #[serde(default)]
18 pub meta: ThemeMeta,
19 pub workspace: Workspace,
20 pub context_menu: ContextMenu,
21 pub contacts_popover: ContactsPopover,
22 pub contact_list: ContactList,
23 pub contact_finder: ContactFinder,
24 pub project_panel: ProjectPanel,
25 pub command_palette: CommandPalette,
26 pub picker: Picker,
27 pub editor: Editor,
28 pub search: Search,
29 pub project_diagnostics: ProjectDiagnostics,
30 pub breadcrumbs: ContainedText,
31 pub contact_notification: ContactNotification,
32 pub update_notification: UpdateNotification,
33 pub project_shared_notification: ProjectSharedNotification,
34 pub incoming_call_notification: IncomingCallNotification,
35 pub tooltip: TooltipStyle,
36 pub terminal: TerminalStyle,
37 pub color_scheme: ColorScheme,
38}
39
40#[derive(Deserialize, Default, Clone)]
41pub struct ThemeMeta {
42 pub name: String,
43 pub is_light: bool,
44}
45
46#[derive(Deserialize, Default)]
47pub struct Workspace {
48 pub background: Color,
49 pub titlebar: Titlebar,
50 pub tab_bar: TabBar,
51 pub pane_divider: Border,
52 pub leader_border_opacity: f32,
53 pub leader_border_width: f32,
54 pub sidebar: Sidebar,
55 pub status_bar: StatusBar,
56 pub toolbar: Toolbar,
57 pub disconnected_overlay: ContainedText,
58 pub modal: ContainerStyle,
59 pub notification: ContainerStyle,
60 pub notifications: Notifications,
61 pub joining_project_avatar: ImageStyle,
62 pub joining_project_message: ContainedText,
63 pub external_location_message: ContainedText,
64 pub dock: Dock,
65}
66
67#[derive(Clone, Deserialize, Default)]
68pub struct Titlebar {
69 #[serde(flatten)]
70 pub container: ContainerStyle,
71 pub height: f32,
72 pub title: TextStyle,
73 pub avatar_width: f32,
74 pub avatar_margin: f32,
75 pub avatar_ribbon: AvatarRibbon,
76 pub offline_icon: OfflineIcon,
77 pub avatar: ImageStyle,
78 pub inactive_avatar: ImageStyle,
79 pub sign_in_prompt: Interactive<ContainedText>,
80 pub outdated_warning: ContainedText,
81 pub share_button: Interactive<ContainedText>,
82 pub call_control: Interactive<IconButton>,
83 pub toggle_contacts_button: Interactive<IconButton>,
84 pub toggle_contacts_badge: ContainerStyle,
85}
86
87#[derive(Deserialize, Default)]
88pub struct ContactsPopover {
89 #[serde(flatten)]
90 pub container: ContainerStyle,
91 pub height: f32,
92 pub width: f32,
93 pub invite_row_height: f32,
94 pub invite_row: Interactive<ContainedLabel>,
95}
96
97#[derive(Deserialize, Default)]
98pub struct ContactList {
99 pub user_query_editor: FieldEditor,
100 pub user_query_editor_height: f32,
101 pub add_contact_button: IconButton,
102 pub header_row: Interactive<ContainedText>,
103 pub leave_call: Interactive<ContainedText>,
104 pub contact_row: Interactive<ContainerStyle>,
105 pub row_height: f32,
106 pub project_row: Interactive<ProjectRow>,
107 pub tree_branch: Interactive<TreeBranch>,
108 pub contact_avatar: ImageStyle,
109 pub contact_status_free: ContainerStyle,
110 pub contact_status_busy: ContainerStyle,
111 pub contact_username: ContainedText,
112 pub contact_button: Interactive<IconButton>,
113 pub contact_button_spacing: f32,
114 pub disabled_button: IconButton,
115 pub section_icon_size: f32,
116 pub calling_indicator: ContainedText,
117}
118
119#[derive(Deserialize, Default)]
120pub struct ProjectRow {
121 #[serde(flatten)]
122 pub container: ContainerStyle,
123 pub icon: Icon,
124 pub name: ContainedText,
125}
126
127#[derive(Deserialize, Default, Clone, Copy)]
128pub struct TreeBranch {
129 pub width: f32,
130 pub color: Color,
131}
132
133#[derive(Deserialize, Default)]
134pub struct ContactFinder {
135 pub picker: Picker,
136 pub row_height: f32,
137 pub contact_avatar: ImageStyle,
138 pub contact_username: ContainerStyle,
139 pub contact_button: IconButton,
140 pub disabled_contact_button: IconButton,
141}
142
143#[derive(Clone, Deserialize, Default)]
144pub struct TabBar {
145 #[serde(flatten)]
146 pub container: ContainerStyle,
147 pub pane_button: Interactive<IconButton>,
148 pub pane_button_container: ContainerStyle,
149 pub active_pane: TabStyles,
150 pub inactive_pane: TabStyles,
151 pub dragged_tab: Tab,
152 pub height: f32,
153 pub drop_target_overlay_color: Color,
154}
155
156impl TabBar {
157 pub fn tab_style(&self, pane_active: bool, tab_active: bool) -> &Tab {
158 let tabs = if pane_active {
159 &self.active_pane
160 } else {
161 &self.inactive_pane
162 };
163
164 if tab_active {
165 &tabs.active_tab
166 } else {
167 &tabs.inactive_tab
168 }
169 }
170}
171
172#[derive(Clone, Deserialize, Default)]
173pub struct TabStyles {
174 pub active_tab: Tab,
175 pub inactive_tab: Tab,
176}
177
178#[derive(Clone, Deserialize, Default)]
179pub struct AvatarRibbon {
180 #[serde(flatten)]
181 pub container: ContainerStyle,
182 pub width: f32,
183 pub height: f32,
184}
185
186#[derive(Clone, Deserialize, Default)]
187pub struct OfflineIcon {
188 #[serde(flatten)]
189 pub container: ContainerStyle,
190 pub width: f32,
191 pub color: Color,
192}
193
194#[derive(Clone, Deserialize, Default)]
195pub struct Tab {
196 pub height: f32,
197 #[serde(flatten)]
198 pub container: ContainerStyle,
199 #[serde(flatten)]
200 pub label: LabelStyle,
201 pub description: ContainedText,
202 pub spacing: f32,
203 pub icon_width: f32,
204 pub icon_close: Color,
205 pub icon_close_active: Color,
206 pub icon_dirty: Color,
207 pub icon_conflict: Color,
208}
209
210#[derive(Clone, Deserialize, Default)]
211pub struct Toolbar {
212 #[serde(flatten)]
213 pub container: ContainerStyle,
214 pub height: f32,
215 pub item_spacing: f32,
216 pub nav_button: Interactive<IconButton>,
217}
218
219#[derive(Clone, Deserialize, Default)]
220pub struct Dock {
221 pub initial_size_right: f32,
222 pub initial_size_bottom: f32,
223 pub wash_color: Color,
224 pub panel: ContainerStyle,
225 pub maximized: ContainerStyle,
226}
227
228#[derive(Clone, Deserialize, Default)]
229pub struct Notifications {
230 #[serde(flatten)]
231 pub container: ContainerStyle,
232 pub width: f32,
233}
234
235#[derive(Clone, Deserialize, Default)]
236pub struct Search {
237 #[serde(flatten)]
238 pub container: ContainerStyle,
239 pub editor: FindEditor,
240 pub invalid_editor: ContainerStyle,
241 pub option_button_group: ContainerStyle,
242 pub option_button: Interactive<ContainedText>,
243 pub match_background: Color,
244 pub match_index: ContainedText,
245 pub results_status: TextStyle,
246 pub tab_icon_width: f32,
247 pub tab_icon_spacing: f32,
248}
249
250#[derive(Clone, Deserialize, Default)]
251pub struct FindEditor {
252 #[serde(flatten)]
253 pub input: FieldEditor,
254 pub min_width: f32,
255 pub max_width: f32,
256}
257
258#[derive(Deserialize, Default)]
259pub struct StatusBar {
260 #[serde(flatten)]
261 pub container: ContainerStyle,
262 pub height: f32,
263 pub item_spacing: f32,
264 pub cursor_position: TextStyle,
265 pub auto_update_progress_message: TextStyle,
266 pub auto_update_done_message: TextStyle,
267 pub lsp_status: Interactive<StatusBarLspStatus>,
268 pub feedback: Interactive<TextStyle>,
269 pub sidebar_buttons: StatusBarSidebarButtons,
270 pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
271 pub diagnostic_message: Interactive<ContainedText>,
272}
273
274#[derive(Deserialize, Default)]
275pub struct StatusBarSidebarButtons {
276 pub group_left: ContainerStyle,
277 pub group_right: ContainerStyle,
278 pub item: Interactive<SidebarItem>,
279 pub badge: ContainerStyle,
280}
281
282#[derive(Deserialize, Default)]
283pub struct StatusBarDiagnosticSummary {
284 pub container_ok: ContainerStyle,
285 pub container_warning: ContainerStyle,
286 pub container_error: ContainerStyle,
287 pub text: TextStyle,
288 pub icon_color_ok: Color,
289 pub icon_color_warning: Color,
290 pub icon_color_error: Color,
291 pub height: f32,
292 pub icon_width: f32,
293 pub icon_spacing: f32,
294 pub summary_spacing: f32,
295}
296
297#[derive(Deserialize, Default)]
298pub struct StatusBarLspStatus {
299 #[serde(flatten)]
300 pub container: ContainerStyle,
301 pub height: f32,
302 pub icon_spacing: f32,
303 pub icon_color: Color,
304 pub icon_width: f32,
305 pub message: TextStyle,
306}
307
308#[derive(Deserialize, Default)]
309pub struct Sidebar {
310 pub initial_size: f32,
311 #[serde(flatten)]
312 pub container: ContainerStyle,
313}
314
315#[derive(Clone, Copy, Deserialize, Default)]
316pub struct SidebarItem {
317 #[serde(flatten)]
318 pub container: ContainerStyle,
319 pub icon_color: Color,
320 pub icon_size: f32,
321}
322
323#[derive(Deserialize, Default)]
324pub struct ProjectPanel {
325 #[serde(flatten)]
326 pub container: ContainerStyle,
327 pub entry: Interactive<ProjectPanelEntry>,
328 pub cut_entry_fade: f32,
329 pub ignored_entry_fade: f32,
330 pub filename_editor: FieldEditor,
331 pub indent_width: f32,
332}
333
334#[derive(Clone, Debug, Deserialize, Default)]
335pub struct ProjectPanelEntry {
336 pub height: f32,
337 #[serde(flatten)]
338 pub container: ContainerStyle,
339 pub text: TextStyle,
340 pub icon_color: Color,
341 pub icon_size: f32,
342 pub icon_spacing: f32,
343}
344
345#[derive(Clone, Debug, Deserialize, Default)]
346pub struct ContextMenu {
347 #[serde(flatten)]
348 pub container: ContainerStyle,
349 pub item: Interactive<ContextMenuItem>,
350 pub keystroke_margin: f32,
351 pub separator: ContainerStyle,
352}
353
354#[derive(Clone, Debug, Deserialize, Default)]
355pub struct ContextMenuItem {
356 #[serde(flatten)]
357 pub container: ContainerStyle,
358 pub label: TextStyle,
359 pub keystroke: ContainedText,
360 pub icon_width: f32,
361 pub icon_spacing: f32,
362}
363
364#[derive(Debug, Deserialize, Default)]
365pub struct CommandPalette {
366 pub key: Interactive<ContainedLabel>,
367 pub keystroke_spacing: f32,
368}
369
370#[derive(Deserialize, Default)]
371pub struct InviteLink {
372 #[serde(flatten)]
373 pub container: ContainerStyle,
374 #[serde(flatten)]
375 pub label: LabelStyle,
376 pub icon: Icon,
377}
378
379#[derive(Deserialize, Default)]
380pub struct Icon {
381 #[serde(flatten)]
382 pub container: ContainerStyle,
383 pub color: Color,
384 pub width: f32,
385}
386
387#[derive(Deserialize, Clone, Copy, Default)]
388pub struct IconButton {
389 #[serde(flatten)]
390 pub container: ContainerStyle,
391 pub color: Color,
392 pub icon_width: f32,
393 pub button_width: f32,
394}
395
396#[derive(Deserialize, Default)]
397pub struct ChatMessage {
398 #[serde(flatten)]
399 pub container: ContainerStyle,
400 pub body: TextStyle,
401 pub sender: ContainedText,
402 pub timestamp: ContainedText,
403}
404
405#[derive(Deserialize, Default)]
406pub struct ChannelSelect {
407 #[serde(flatten)]
408 pub container: ContainerStyle,
409 pub header: ChannelName,
410 pub item: ChannelName,
411 pub active_item: ChannelName,
412 pub hovered_item: ChannelName,
413 pub hovered_active_item: ChannelName,
414 pub menu: ContainerStyle,
415}
416
417#[derive(Deserialize, Default)]
418pub struct ChannelName {
419 #[serde(flatten)]
420 pub container: ContainerStyle,
421 pub hash: ContainedText,
422 pub name: TextStyle,
423}
424
425#[derive(Deserialize, Default)]
426pub struct Picker {
427 #[serde(flatten)]
428 pub container: ContainerStyle,
429 pub empty: ContainedLabel,
430 pub input_editor: FieldEditor,
431 pub item: Interactive<ContainedLabel>,
432}
433
434#[derive(Clone, Debug, Deserialize, Default)]
435pub struct ContainedText {
436 #[serde(flatten)]
437 pub container: ContainerStyle,
438 #[serde(flatten)]
439 pub text: TextStyle,
440}
441
442#[derive(Clone, Debug, Deserialize, Default)]
443pub struct ContainedLabel {
444 #[serde(flatten)]
445 pub container: ContainerStyle,
446 #[serde(flatten)]
447 pub label: LabelStyle,
448}
449
450#[derive(Clone, Deserialize, Default)]
451pub struct ProjectDiagnostics {
452 #[serde(flatten)]
453 pub container: ContainerStyle,
454 pub empty_message: TextStyle,
455 pub tab_icon_width: f32,
456 pub tab_icon_spacing: f32,
457 pub tab_summary_spacing: f32,
458}
459
460#[derive(Deserialize, Default)]
461pub struct ContactNotification {
462 pub header_avatar: ImageStyle,
463 pub header_message: ContainedText,
464 pub header_height: f32,
465 pub body_message: ContainedText,
466 pub button: Interactive<ContainedText>,
467 pub dismiss_button: Interactive<IconButton>,
468}
469
470#[derive(Deserialize, Default)]
471pub struct UpdateNotification {
472 pub message: ContainedText,
473 pub action_message: Interactive<ContainedText>,
474 pub dismiss_button: Interactive<IconButton>,
475}
476
477#[derive(Deserialize, Default)]
478pub struct ProjectSharedNotification {
479 pub window_height: f32,
480 pub window_width: f32,
481 #[serde(default)]
482 pub background: Color,
483 pub owner_container: ContainerStyle,
484 pub owner_avatar: ImageStyle,
485 pub owner_metadata: ContainerStyle,
486 pub owner_username: ContainedText,
487 pub message: ContainedText,
488 pub worktree_roots: ContainedText,
489 pub button_width: f32,
490 pub open_button: ContainedText,
491 pub dismiss_button: ContainedText,
492}
493
494#[derive(Deserialize, Default)]
495pub struct IncomingCallNotification {
496 pub window_height: f32,
497 pub window_width: f32,
498 #[serde(default)]
499 pub background: Color,
500 pub caller_container: ContainerStyle,
501 pub caller_avatar: ImageStyle,
502 pub caller_metadata: ContainerStyle,
503 pub caller_username: ContainedText,
504 pub caller_message: ContainedText,
505 pub worktree_roots: ContainedText,
506 pub button_width: f32,
507 pub accept_button: ContainedText,
508 pub decline_button: ContainedText,
509}
510
511#[derive(Clone, Deserialize, Default)]
512pub struct Editor {
513 pub text_color: Color,
514 #[serde(default)]
515 pub background: Color,
516 pub selection: SelectionStyle,
517 pub gutter_background: Color,
518 pub gutter_padding_factor: f32,
519 pub active_line_background: Color,
520 pub highlighted_line_background: Color,
521 pub rename_fade: f32,
522 pub document_highlight_read_background: Color,
523 pub document_highlight_write_background: Color,
524 pub diff: DiffStyle,
525 pub line_number: Color,
526 pub line_number_active: Color,
527 pub guest_selections: Vec<SelectionStyle>,
528 pub syntax: Arc<SyntaxTheme>,
529 pub diagnostic_path_header: DiagnosticPathHeader,
530 pub diagnostic_header: DiagnosticHeader,
531 pub error_diagnostic: DiagnosticStyle,
532 pub invalid_error_diagnostic: DiagnosticStyle,
533 pub warning_diagnostic: DiagnosticStyle,
534 pub invalid_warning_diagnostic: DiagnosticStyle,
535 pub information_diagnostic: DiagnosticStyle,
536 pub invalid_information_diagnostic: DiagnosticStyle,
537 pub hint_diagnostic: DiagnosticStyle,
538 pub invalid_hint_diagnostic: DiagnosticStyle,
539 pub autocomplete: AutocompleteStyle,
540 pub code_actions: CodeActions,
541 pub unnecessary_code_fade: f32,
542 pub hover_popover: HoverPopover,
543 pub link_definition: HighlightStyle,
544 pub composition_mark: HighlightStyle,
545 pub jump_icon: Interactive<IconButton>,
546 pub scrollbar: Scrollbar,
547}
548
549#[derive(Clone, Deserialize, Default)]
550pub struct Scrollbar {
551 pub track: ContainerStyle,
552 pub thumb: ContainerStyle,
553 pub width: f32,
554 pub min_height_factor: f32,
555}
556
557#[derive(Clone, Deserialize, Default)]
558pub struct DiagnosticPathHeader {
559 #[serde(flatten)]
560 pub container: ContainerStyle,
561 pub filename: ContainedText,
562 pub path: ContainedText,
563 pub text_scale_factor: f32,
564}
565
566#[derive(Clone, Deserialize, Default)]
567pub struct DiagnosticHeader {
568 #[serde(flatten)]
569 pub container: ContainerStyle,
570 pub message: ContainedLabel,
571 pub code: ContainedText,
572 pub text_scale_factor: f32,
573 pub icon_width_factor: f32,
574}
575
576#[derive(Clone, Deserialize, Default)]
577pub struct DiagnosticStyle {
578 pub message: LabelStyle,
579 #[serde(default)]
580 pub header: ContainerStyle,
581 pub text_scale_factor: f32,
582}
583
584#[derive(Clone, Deserialize, Default)]
585pub struct AutocompleteStyle {
586 #[serde(flatten)]
587 pub container: ContainerStyle,
588 pub item: ContainerStyle,
589 pub selected_item: ContainerStyle,
590 pub hovered_item: ContainerStyle,
591 pub match_highlight: HighlightStyle,
592}
593
594#[derive(Clone, Copy, Default, Deserialize)]
595pub struct SelectionStyle {
596 pub cursor: Color,
597 pub selection: Color,
598}
599
600#[derive(Clone, Deserialize, Default)]
601pub struct FieldEditor {
602 #[serde(flatten)]
603 pub container: ContainerStyle,
604 pub text: TextStyle,
605 #[serde(default)]
606 pub placeholder_text: Option<TextStyle>,
607 pub selection: SelectionStyle,
608}
609
610#[derive(Clone, Deserialize, Default)]
611pub struct CodeActions {
612 #[serde(default)]
613 pub indicator: Color,
614 pub vertical_scale: f32,
615}
616
617#[derive(Clone, Deserialize, Default)]
618pub struct DiffStyle {
619 pub inserted: Color,
620 pub modified: Color,
621 pub deleted: Color,
622 pub removed_width_em: f32,
623 pub width_em: f32,
624 pub corner_radius: f32,
625}
626
627#[derive(Debug, Default, Clone, Copy)]
628pub struct Interactive<T> {
629 pub default: T,
630 pub hover: Option<T>,
631 pub clicked: Option<T>,
632 pub active: Option<T>,
633 pub disabled: Option<T>,
634}
635
636impl<T> Interactive<T> {
637 pub fn style_for(&self, state: &mut MouseState, active: bool) -> &T {
638 if active {
639 self.active.as_ref().unwrap_or(&self.default)
640 } else if state.clicked() == Some(gpui::MouseButton::Left) && self.clicked.is_some() {
641 self.clicked.as_ref().unwrap()
642 } else if state.hovered() {
643 self.hover.as_ref().unwrap_or(&self.default)
644 } else {
645 &self.default
646 }
647 }
648
649 pub fn disabled_style(&self) -> &T {
650 self.disabled.as_ref().unwrap_or(&self.default)
651 }
652}
653
654impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
655 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
656 where
657 D: serde::Deserializer<'de>,
658 {
659 #[derive(Deserialize)]
660 struct Helper {
661 #[serde(flatten)]
662 default: Value,
663 hover: Option<Value>,
664 clicked: Option<Value>,
665 active: Option<Value>,
666 disabled: Option<Value>,
667 }
668
669 let json = Helper::deserialize(deserializer)?;
670
671 let deserialize_state = |state_json: Option<Value>| -> Result<Option<T>, D::Error> {
672 if let Some(mut state_json) = state_json {
673 if let Value::Object(state_json) = &mut state_json {
674 if let Value::Object(default) = &json.default {
675 for (key, value) in default {
676 if !state_json.contains_key(key) {
677 state_json.insert(key.clone(), value.clone());
678 }
679 }
680 }
681 }
682 Ok(Some(
683 serde_json::from_value::<T>(state_json).map_err(serde::de::Error::custom)?,
684 ))
685 } else {
686 Ok(None)
687 }
688 };
689
690 let hover = deserialize_state(json.hover)?;
691 let clicked = deserialize_state(json.clicked)?;
692 let active = deserialize_state(json.active)?;
693 let disabled = deserialize_state(json.disabled)?;
694 let default = serde_json::from_value(json.default).map_err(serde::de::Error::custom)?;
695
696 Ok(Interactive {
697 default,
698 hover,
699 clicked,
700 active,
701 disabled,
702 })
703 }
704}
705
706impl Editor {
707 pub fn replica_selection_style(&self, replica_id: u16) -> &SelectionStyle {
708 let style_ix = replica_id as usize % (self.guest_selections.len() + 1);
709 if style_ix == 0 {
710 &self.selection
711 } else {
712 &self.guest_selections[style_ix - 1]
713 }
714 }
715}
716
717#[derive(Default)]
718pub struct SyntaxTheme {
719 pub highlights: Vec<(String, HighlightStyle)>,
720}
721
722impl SyntaxTheme {
723 pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
724 Self { highlights }
725 }
726}
727
728impl<'de> Deserialize<'de> for SyntaxTheme {
729 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
730 where
731 D: serde::Deserializer<'de>,
732 {
733 let syntax_data: HashMap<String, HighlightStyle> = Deserialize::deserialize(deserializer)?;
734
735 let mut result = Self::new(Vec::new());
736 for (key, style) in syntax_data {
737 match result
738 .highlights
739 .binary_search_by(|(needle, _)| needle.cmp(&key))
740 {
741 Ok(i) | Err(i) => {
742 result.highlights.insert(i, (key, style));
743 }
744 }
745 }
746
747 Ok(result)
748 }
749}
750
751#[derive(Clone, Deserialize, Default)]
752pub struct HoverPopover {
753 pub container: ContainerStyle,
754 pub info_container: ContainerStyle,
755 pub warning_container: ContainerStyle,
756 pub error_container: ContainerStyle,
757 pub block_style: ContainerStyle,
758 pub prose: TextStyle,
759 pub highlight: Color,
760}
761
762#[derive(Clone, Deserialize, Default)]
763pub struct TerminalStyle {
764 pub black: Color,
765 pub red: Color,
766 pub green: Color,
767 pub yellow: Color,
768 pub blue: Color,
769 pub magenta: Color,
770 pub cyan: Color,
771 pub white: Color,
772 pub bright_black: Color,
773 pub bright_red: Color,
774 pub bright_green: Color,
775 pub bright_yellow: Color,
776 pub bright_blue: Color,
777 pub bright_magenta: Color,
778 pub bright_cyan: Color,
779 pub bright_white: Color,
780 pub foreground: Color,
781 pub background: Color,
782 pub modal_background: Color,
783 pub cursor: Color,
784 pub dim_black: Color,
785 pub dim_red: Color,
786 pub dim_green: Color,
787 pub dim_yellow: Color,
788 pub dim_blue: Color,
789 pub dim_magenta: Color,
790 pub dim_cyan: Color,
791 pub dim_white: Color,
792 pub bright_foreground: Color,
793 pub dim_foreground: Color,
794}
795
796#[derive(Clone, Deserialize, Default)]
797pub struct ColorScheme {
798 pub name: String,
799 pub is_light: bool,
800
801 pub ramps: RampSet,
802
803 pub lowest: Layer,
804 pub middle: Layer,
805 pub highest: Layer,
806
807 pub popover_shadow: Shadow,
808 pub modal_shadow: Shadow,
809
810 pub players: Vec<Player>,
811}
812
813#[derive(Clone, Deserialize, Default)]
814pub struct Player {
815 pub cursor: Color,
816 pub selection: Color,
817}
818
819#[derive(Clone, Deserialize, Default)]
820pub struct RampSet {
821 pub neutral: Vec<Color>,
822 pub red: Vec<Color>,
823 pub orange: Vec<Color>,
824 pub yellow: Vec<Color>,
825 pub green: Vec<Color>,
826 pub cyan: Vec<Color>,
827 pub blue: Vec<Color>,
828 pub violet: Vec<Color>,
829 pub magenta: Vec<Color>,
830}
831
832#[derive(Clone, Deserialize, Default)]
833pub struct Layer {
834 pub base: StyleSet,
835 pub variant: StyleSet,
836 pub on: StyleSet,
837 pub accent: StyleSet,
838 pub positive: StyleSet,
839 pub warning: StyleSet,
840 pub negative: StyleSet,
841}
842
843#[derive(Clone, Deserialize, Default)]
844pub struct StyleSet {
845 pub default: Style,
846 pub active: Style,
847 pub disabled: Style,
848 pub hovered: Style,
849 pub pressed: Style,
850 pub inverted: Style,
851}
852
853#[derive(Clone, Deserialize, Default)]
854pub struct Style {
855 pub background: Color,
856 pub border: Color,
857 pub foreground: Color,
858}