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 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 name: ContainedText,
124}
125
126#[derive(Deserialize, Default, Clone, Copy)]
127pub struct TreeBranch {
128    pub width: f32,
129    pub color: Color,
130}
131
132#[derive(Deserialize, Default)]
133pub struct ContactFinder {
134    pub picker: Picker,
135    pub row_height: f32,
136    pub contact_avatar: ImageStyle,
137    pub contact_username: ContainerStyle,
138    pub contact_button: IconButton,
139    pub disabled_contact_button: IconButton,
140}
141
142#[derive(Clone, Deserialize, Default)]
143pub struct TabBar {
144    #[serde(flatten)]
145    pub container: ContainerStyle,
146    pub pane_button: Interactive<IconButton>,
147    pub pane_button_container: ContainerStyle,
148    pub active_pane: TabStyles,
149    pub inactive_pane: TabStyles,
150    pub dragged_tab: Tab,
151    pub height: f32,
152    pub drop_target_overlay_color: Color,
153}
154
155impl TabBar {
156    pub fn tab_style(&self, pane_active: bool, tab_active: bool) -> &Tab {
157        let tabs = if pane_active {
158            &self.active_pane
159        } else {
160            &self.inactive_pane
161        };
162
163        if tab_active {
164            &tabs.active_tab
165        } else {
166            &tabs.inactive_tab
167        }
168    }
169}
170
171#[derive(Clone, Deserialize, Default)]
172pub struct TabStyles {
173    pub active_tab: Tab,
174    pub inactive_tab: Tab,
175}
176
177#[derive(Clone, Deserialize, Default)]
178pub struct AvatarRibbon {
179    #[serde(flatten)]
180    pub container: ContainerStyle,
181    pub width: f32,
182    pub height: f32,
183}
184
185#[derive(Clone, Deserialize, Default)]
186pub struct OfflineIcon {
187    #[serde(flatten)]
188    pub container: ContainerStyle,
189    pub width: f32,
190    pub color: Color,
191}
192
193#[derive(Clone, Deserialize, Default)]
194pub struct Tab {
195    pub height: f32,
196    #[serde(flatten)]
197    pub container: ContainerStyle,
198    #[serde(flatten)]
199    pub label: LabelStyle,
200    pub description: ContainedText,
201    pub spacing: f32,
202    pub icon_width: f32,
203    pub icon_close: Color,
204    pub icon_close_active: Color,
205    pub icon_dirty: Color,
206    pub icon_conflict: Color,
207}
208
209#[derive(Clone, Deserialize, Default)]
210pub struct Toolbar {
211    #[serde(flatten)]
212    pub container: ContainerStyle,
213    pub height: f32,
214    pub item_spacing: f32,
215    pub nav_button: Interactive<IconButton>,
216}
217
218#[derive(Clone, Deserialize, Default)]
219pub struct Dock {
220    pub initial_size_right: f32,
221    pub initial_size_bottom: f32,
222    pub wash_color: Color,
223    pub panel: ContainerStyle,
224    pub maximized: ContainerStyle,
225}
226
227#[derive(Clone, Deserialize, Default)]
228pub struct Notifications {
229    #[serde(flatten)]
230    pub container: ContainerStyle,
231    pub width: f32,
232}
233
234#[derive(Clone, Deserialize, Default)]
235pub struct Search {
236    #[serde(flatten)]
237    pub container: ContainerStyle,
238    pub editor: FindEditor,
239    pub invalid_editor: ContainerStyle,
240    pub option_button_group: ContainerStyle,
241    pub option_button: Interactive<ContainedText>,
242    pub match_background: Color,
243    pub match_index: ContainedText,
244    pub results_status: TextStyle,
245    pub tab_icon_width: f32,
246    pub tab_icon_spacing: f32,
247}
248
249#[derive(Clone, Deserialize, Default)]
250pub struct FindEditor {
251    #[serde(flatten)]
252    pub input: FieldEditor,
253    pub min_width: f32,
254    pub max_width: f32,
255}
256
257#[derive(Deserialize, Default)]
258pub struct StatusBar {
259    #[serde(flatten)]
260    pub container: ContainerStyle,
261    pub height: f32,
262    pub item_spacing: f32,
263    pub cursor_position: TextStyle,
264    pub auto_update_progress_message: TextStyle,
265    pub auto_update_done_message: TextStyle,
266    pub lsp_status: Interactive<StatusBarLspStatus>,
267    pub feedback: Interactive<TextStyle>,
268    pub sidebar_buttons: StatusBarSidebarButtons,
269    pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
270    pub diagnostic_message: Interactive<ContainedText>,
271}
272
273#[derive(Deserialize, Default)]
274pub struct StatusBarSidebarButtons {
275    pub group_left: ContainerStyle,
276    pub group_right: ContainerStyle,
277    pub item: Interactive<SidebarItem>,
278    pub badge: ContainerStyle,
279}
280
281#[derive(Deserialize, Default)]
282pub struct StatusBarDiagnosticSummary {
283    pub container_ok: ContainerStyle,
284    pub container_warning: ContainerStyle,
285    pub container_error: ContainerStyle,
286    pub text: TextStyle,
287    pub icon_color_ok: Color,
288    pub icon_color_warning: Color,
289    pub icon_color_error: Color,
290    pub height: f32,
291    pub icon_width: f32,
292    pub icon_spacing: f32,
293    pub summary_spacing: f32,
294}
295
296#[derive(Deserialize, Default)]
297pub struct StatusBarLspStatus {
298    #[serde(flatten)]
299    pub container: ContainerStyle,
300    pub height: f32,
301    pub icon_spacing: f32,
302    pub icon_color: Color,
303    pub icon_width: f32,
304    pub message: TextStyle,
305}
306
307#[derive(Deserialize, Default)]
308pub struct Sidebar {
309    pub initial_size: f32,
310    #[serde(flatten)]
311    pub container: ContainerStyle,
312}
313
314#[derive(Clone, Copy, Deserialize, Default)]
315pub struct SidebarItem {
316    #[serde(flatten)]
317    pub container: ContainerStyle,
318    pub icon_color: Color,
319    pub icon_size: f32,
320}
321
322#[derive(Deserialize, Default)]
323pub struct ProjectPanel {
324    #[serde(flatten)]
325    pub container: ContainerStyle,
326    pub entry: Interactive<ProjectPanelEntry>,
327    pub cut_entry_fade: f32,
328    pub ignored_entry_fade: f32,
329    pub filename_editor: FieldEditor,
330    pub indent_width: f32,
331}
332
333#[derive(Clone, Debug, Deserialize, Default)]
334pub struct ProjectPanelEntry {
335    pub height: f32,
336    #[serde(flatten)]
337    pub container: ContainerStyle,
338    pub text: TextStyle,
339    pub icon_color: Color,
340    pub icon_size: f32,
341    pub icon_spacing: f32,
342}
343
344#[derive(Clone, Debug, Deserialize, Default)]
345pub struct ContextMenu {
346    #[serde(flatten)]
347    pub container: ContainerStyle,
348    pub item: Interactive<ContextMenuItem>,
349    pub keystroke_margin: f32,
350    pub separator: ContainerStyle,
351}
352
353#[derive(Clone, Debug, Deserialize, Default)]
354pub struct ContextMenuItem {
355    #[serde(flatten)]
356    pub container: ContainerStyle,
357    pub label: TextStyle,
358    pub keystroke: ContainedText,
359    pub icon_width: f32,
360    pub icon_spacing: f32,
361}
362
363#[derive(Debug, Deserialize, Default)]
364pub struct CommandPalette {
365    pub key: Interactive<ContainedLabel>,
366    pub keystroke_spacing: f32,
367}
368
369#[derive(Deserialize, Default)]
370pub struct InviteLink {
371    #[serde(flatten)]
372    pub container: ContainerStyle,
373    #[serde(flatten)]
374    pub label: LabelStyle,
375    pub icon: Icon,
376}
377
378#[derive(Deserialize, Default)]
379pub struct Icon {
380    #[serde(flatten)]
381    pub container: ContainerStyle,
382    pub color: Color,
383    pub width: f32,
384    pub path: String,
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}