theme.rs

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