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