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 dragged_entry: ProjectPanelEntry,
330    pub ignored_entry: Interactive<ProjectPanelEntry>,
331    pub cut_entry: Interactive<ProjectPanelEntry>,
332    pub filename_editor: FieldEditor,
333    pub indent_width: f32,
334}
335
336#[derive(Clone, Debug, Deserialize, Default)]
337pub struct ProjectPanelEntry {
338    pub height: f32,
339    #[serde(flatten)]
340    pub container: ContainerStyle,
341    pub text: TextStyle,
342    pub icon_color: Color,
343    pub icon_size: f32,
344    pub icon_spacing: f32,
345}
346
347#[derive(Clone, Debug, Deserialize, Default)]
348pub struct ContextMenu {
349    #[serde(flatten)]
350    pub container: ContainerStyle,
351    pub item: Interactive<ContextMenuItem>,
352    pub keystroke_margin: f32,
353    pub separator: ContainerStyle,
354}
355
356#[derive(Clone, Debug, Deserialize, Default)]
357pub struct ContextMenuItem {
358    #[serde(flatten)]
359    pub container: ContainerStyle,
360    pub label: TextStyle,
361    pub keystroke: ContainedText,
362    pub icon_width: f32,
363    pub icon_spacing: f32,
364}
365
366#[derive(Debug, Deserialize, Default)]
367pub struct CommandPalette {
368    pub key: Interactive<ContainedLabel>,
369    pub keystroke_spacing: f32,
370}
371
372#[derive(Deserialize, Default)]
373pub struct InviteLink {
374    #[serde(flatten)]
375    pub container: ContainerStyle,
376    #[serde(flatten)]
377    pub label: LabelStyle,
378    pub icon: Icon,
379}
380
381#[derive(Deserialize, Default)]
382pub struct Icon {
383    #[serde(flatten)]
384    pub container: ContainerStyle,
385    pub color: Color,
386    pub width: f32,
387}
388
389#[derive(Deserialize, Clone, Copy, Default)]
390pub struct IconButton {
391    #[serde(flatten)]
392    pub container: ContainerStyle,
393    pub color: Color,
394    pub icon_width: f32,
395    pub button_width: f32,
396}
397
398#[derive(Deserialize, Default)]
399pub struct ChatMessage {
400    #[serde(flatten)]
401    pub container: ContainerStyle,
402    pub body: TextStyle,
403    pub sender: ContainedText,
404    pub timestamp: ContainedText,
405}
406
407#[derive(Deserialize, Default)]
408pub struct ChannelSelect {
409    #[serde(flatten)]
410    pub container: ContainerStyle,
411    pub header: ChannelName,
412    pub item: ChannelName,
413    pub active_item: ChannelName,
414    pub hovered_item: ChannelName,
415    pub hovered_active_item: ChannelName,
416    pub menu: ContainerStyle,
417}
418
419#[derive(Deserialize, Default)]
420pub struct ChannelName {
421    #[serde(flatten)]
422    pub container: ContainerStyle,
423    pub hash: ContainedText,
424    pub name: TextStyle,
425}
426
427#[derive(Clone, Deserialize, Default)]
428pub struct Picker {
429    #[serde(flatten)]
430    pub container: ContainerStyle,
431    pub empty_container: ContainerStyle,
432    pub input_editor: FieldEditor,
433    pub empty_input_editor: FieldEditor,
434    pub no_matches: ContainedLabel,
435    pub item: Interactive<ContainedLabel>,
436}
437
438#[derive(Clone, Debug, Deserialize, Default)]
439pub struct ContainedText {
440    #[serde(flatten)]
441    pub container: ContainerStyle,
442    #[serde(flatten)]
443    pub text: TextStyle,
444}
445
446#[derive(Clone, Debug, Deserialize, Default)]
447pub struct ContainedLabel {
448    #[serde(flatten)]
449    pub container: ContainerStyle,
450    #[serde(flatten)]
451    pub label: LabelStyle,
452}
453
454#[derive(Clone, Deserialize, Default)]
455pub struct ProjectDiagnostics {
456    #[serde(flatten)]
457    pub container: ContainerStyle,
458    pub empty_message: TextStyle,
459    pub tab_icon_width: f32,
460    pub tab_icon_spacing: f32,
461    pub tab_summary_spacing: f32,
462}
463
464#[derive(Deserialize, Default)]
465pub struct ContactNotification {
466    pub header_avatar: ImageStyle,
467    pub header_message: ContainedText,
468    pub header_height: f32,
469    pub body_message: ContainedText,
470    pub button: Interactive<ContainedText>,
471    pub dismiss_button: Interactive<IconButton>,
472}
473
474#[derive(Deserialize, Default)]
475pub struct UpdateNotification {
476    pub message: ContainedText,
477    pub action_message: Interactive<ContainedText>,
478    pub dismiss_button: Interactive<IconButton>,
479}
480
481#[derive(Deserialize, Default)]
482pub struct ProjectSharedNotification {
483    pub window_height: f32,
484    pub window_width: f32,
485    #[serde(default)]
486    pub background: Color,
487    pub owner_container: ContainerStyle,
488    pub owner_avatar: ImageStyle,
489    pub owner_metadata: ContainerStyle,
490    pub owner_username: ContainedText,
491    pub message: ContainedText,
492    pub worktree_roots: ContainedText,
493    pub button_width: f32,
494    pub open_button: ContainedText,
495    pub dismiss_button: ContainedText,
496}
497
498#[derive(Deserialize, Default)]
499pub struct IncomingCallNotification {
500    pub window_height: f32,
501    pub window_width: f32,
502    #[serde(default)]
503    pub background: Color,
504    pub caller_container: ContainerStyle,
505    pub caller_avatar: ImageStyle,
506    pub caller_metadata: ContainerStyle,
507    pub caller_username: ContainedText,
508    pub caller_message: ContainedText,
509    pub worktree_roots: ContainedText,
510    pub button_width: f32,
511    pub accept_button: ContainedText,
512    pub decline_button: ContainedText,
513}
514
515#[derive(Clone, Deserialize, Default)]
516pub struct Editor {
517    pub text_color: Color,
518    #[serde(default)]
519    pub background: Color,
520    pub selection: SelectionStyle,
521    pub gutter_background: Color,
522    pub gutter_padding_factor: f32,
523    pub active_line_background: Color,
524    pub highlighted_line_background: Color,
525    pub rename_fade: f32,
526    pub document_highlight_read_background: Color,
527    pub document_highlight_write_background: Color,
528    pub diff: DiffStyle,
529    pub line_number: Color,
530    pub line_number_active: Color,
531    pub guest_selections: Vec<SelectionStyle>,
532    pub syntax: Arc<SyntaxTheme>,
533    pub diagnostic_path_header: DiagnosticPathHeader,
534    pub diagnostic_header: DiagnosticHeader,
535    pub error_diagnostic: DiagnosticStyle,
536    pub invalid_error_diagnostic: DiagnosticStyle,
537    pub warning_diagnostic: DiagnosticStyle,
538    pub invalid_warning_diagnostic: DiagnosticStyle,
539    pub information_diagnostic: DiagnosticStyle,
540    pub invalid_information_diagnostic: DiagnosticStyle,
541    pub hint_diagnostic: DiagnosticStyle,
542    pub invalid_hint_diagnostic: DiagnosticStyle,
543    pub autocomplete: AutocompleteStyle,
544    pub code_actions: CodeActions,
545    pub unnecessary_code_fade: f32,
546    pub hover_popover: HoverPopover,
547    pub link_definition: HighlightStyle,
548    pub composition_mark: HighlightStyle,
549    pub jump_icon: Interactive<IconButton>,
550    pub scrollbar: Scrollbar,
551}
552
553#[derive(Clone, Deserialize, Default)]
554pub struct Scrollbar {
555    pub track: ContainerStyle,
556    pub thumb: ContainerStyle,
557    pub width: f32,
558    pub min_height_factor: f32,
559}
560
561#[derive(Clone, Deserialize, Default)]
562pub struct DiagnosticPathHeader {
563    #[serde(flatten)]
564    pub container: ContainerStyle,
565    pub filename: ContainedText,
566    pub path: ContainedText,
567    pub text_scale_factor: f32,
568}
569
570#[derive(Clone, Deserialize, Default)]
571pub struct DiagnosticHeader {
572    #[serde(flatten)]
573    pub container: ContainerStyle,
574    pub message: ContainedLabel,
575    pub code: ContainedText,
576    pub text_scale_factor: f32,
577    pub icon_width_factor: f32,
578}
579
580#[derive(Clone, Deserialize, Default)]
581pub struct DiagnosticStyle {
582    pub message: LabelStyle,
583    #[serde(default)]
584    pub header: ContainerStyle,
585    pub text_scale_factor: f32,
586}
587
588#[derive(Clone, Deserialize, Default)]
589pub struct AutocompleteStyle {
590    #[serde(flatten)]
591    pub container: ContainerStyle,
592    pub item: ContainerStyle,
593    pub selected_item: ContainerStyle,
594    pub hovered_item: ContainerStyle,
595    pub match_highlight: HighlightStyle,
596}
597
598#[derive(Clone, Copy, Default, Deserialize)]
599pub struct SelectionStyle {
600    pub cursor: Color,
601    pub selection: Color,
602}
603
604#[derive(Clone, Deserialize, Default)]
605pub struct FieldEditor {
606    #[serde(flatten)]
607    pub container: ContainerStyle,
608    pub text: TextStyle,
609    #[serde(default)]
610    pub placeholder_text: Option<TextStyle>,
611    pub selection: SelectionStyle,
612}
613
614#[derive(Clone, Deserialize, Default)]
615pub struct CodeActions {
616    #[serde(default)]
617    pub indicator: Color,
618    pub vertical_scale: f32,
619}
620
621#[derive(Clone, Deserialize, Default)]
622pub struct DiffStyle {
623    pub inserted: Color,
624    pub modified: Color,
625    pub deleted: Color,
626    pub removed_width_em: f32,
627    pub width_em: f32,
628    pub corner_radius: f32,
629}
630
631#[derive(Debug, Default, Clone, Copy)]
632pub struct Interactive<T> {
633    pub default: T,
634    pub hover: Option<T>,
635    pub clicked: Option<T>,
636    pub active: Option<T>,
637    pub disabled: Option<T>,
638}
639
640impl<T> Interactive<T> {
641    pub fn style_for(&self, state: &mut MouseState, active: bool) -> &T {
642        if active {
643            self.active.as_ref().unwrap_or(&self.default)
644        } else if state.clicked() == Some(gpui::MouseButton::Left) && self.clicked.is_some() {
645            self.clicked.as_ref().unwrap()
646        } else if state.hovered() {
647            self.hover.as_ref().unwrap_or(&self.default)
648        } else {
649            &self.default
650        }
651    }
652
653    pub fn disabled_style(&self) -> &T {
654        self.disabled.as_ref().unwrap_or(&self.default)
655    }
656}
657
658impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
659    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
660    where
661        D: serde::Deserializer<'de>,
662    {
663        #[derive(Deserialize)]
664        struct Helper {
665            #[serde(flatten)]
666            default: Value,
667            hover: Option<Value>,
668            clicked: Option<Value>,
669            active: Option<Value>,
670            disabled: Option<Value>,
671        }
672
673        let json = Helper::deserialize(deserializer)?;
674
675        let deserialize_state = |state_json: Option<Value>| -> Result<Option<T>, D::Error> {
676            if let Some(mut state_json) = state_json {
677                if let Value::Object(state_json) = &mut state_json {
678                    if let Value::Object(default) = &json.default {
679                        for (key, value) in default {
680                            if !state_json.contains_key(key) {
681                                state_json.insert(key.clone(), value.clone());
682                            }
683                        }
684                    }
685                }
686                Ok(Some(
687                    serde_json::from_value::<T>(state_json).map_err(serde::de::Error::custom)?,
688                ))
689            } else {
690                Ok(None)
691            }
692        };
693
694        let hover = deserialize_state(json.hover)?;
695        let clicked = deserialize_state(json.clicked)?;
696        let active = deserialize_state(json.active)?;
697        let disabled = deserialize_state(json.disabled)?;
698        let default = serde_json::from_value(json.default).map_err(serde::de::Error::custom)?;
699
700        Ok(Interactive {
701            default,
702            hover,
703            clicked,
704            active,
705            disabled,
706        })
707    }
708}
709
710impl Editor {
711    pub fn replica_selection_style(&self, replica_id: u16) -> &SelectionStyle {
712        let style_ix = replica_id as usize % (self.guest_selections.len() + 1);
713        if style_ix == 0 {
714            &self.selection
715        } else {
716            &self.guest_selections[style_ix - 1]
717        }
718    }
719}
720
721#[derive(Default)]
722pub struct SyntaxTheme {
723    pub highlights: Vec<(String, HighlightStyle)>,
724}
725
726impl SyntaxTheme {
727    pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
728        Self { highlights }
729    }
730}
731
732impl<'de> Deserialize<'de> for SyntaxTheme {
733    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
734    where
735        D: serde::Deserializer<'de>,
736    {
737        let syntax_data: HashMap<String, HighlightStyle> = Deserialize::deserialize(deserializer)?;
738
739        let mut result = Self::new(Vec::new());
740        for (key, style) in syntax_data {
741            match result
742                .highlights
743                .binary_search_by(|(needle, _)| needle.cmp(&key))
744            {
745                Ok(i) | Err(i) => {
746                    result.highlights.insert(i, (key, style));
747                }
748            }
749        }
750
751        Ok(result)
752    }
753}
754
755#[derive(Clone, Deserialize, Default)]
756pub struct HoverPopover {
757    pub container: ContainerStyle,
758    pub info_container: ContainerStyle,
759    pub warning_container: ContainerStyle,
760    pub error_container: ContainerStyle,
761    pub block_style: ContainerStyle,
762    pub prose: TextStyle,
763    pub highlight: Color,
764}
765
766#[derive(Clone, Deserialize, Default)]
767pub struct TerminalStyle {
768    pub black: Color,
769    pub red: Color,
770    pub green: Color,
771    pub yellow: Color,
772    pub blue: Color,
773    pub magenta: Color,
774    pub cyan: Color,
775    pub white: Color,
776    pub bright_black: Color,
777    pub bright_red: Color,
778    pub bright_green: Color,
779    pub bright_yellow: Color,
780    pub bright_blue: Color,
781    pub bright_magenta: Color,
782    pub bright_cyan: Color,
783    pub bright_white: Color,
784    pub foreground: Color,
785    pub background: Color,
786    pub modal_background: Color,
787    pub cursor: Color,
788    pub dim_black: Color,
789    pub dim_red: Color,
790    pub dim_green: Color,
791    pub dim_yellow: Color,
792    pub dim_blue: Color,
793    pub dim_magenta: Color,
794    pub dim_cyan: Color,
795    pub dim_white: Color,
796    pub bright_foreground: Color,
797    pub dim_foreground: Color,
798}
799
800#[derive(Clone, Deserialize, Default)]
801pub struct ColorScheme {
802    pub name: String,
803    pub is_light: bool,
804
805    pub ramps: RampSet,
806
807    pub lowest: Layer,
808    pub middle: Layer,
809    pub highest: Layer,
810
811    pub popover_shadow: Shadow,
812    pub modal_shadow: Shadow,
813
814    pub players: Vec<Player>,
815}
816
817#[derive(Clone, Deserialize, Default)]
818pub struct Player {
819    pub cursor: Color,
820    pub selection: Color,
821}
822
823#[derive(Clone, Deserialize, Default)]
824pub struct RampSet {
825    pub neutral: Vec<Color>,
826    pub red: Vec<Color>,
827    pub orange: Vec<Color>,
828    pub yellow: Vec<Color>,
829    pub green: Vec<Color>,
830    pub cyan: Vec<Color>,
831    pub blue: Vec<Color>,
832    pub violet: Vec<Color>,
833    pub magenta: Vec<Color>,
834}
835
836#[derive(Clone, Deserialize, Default)]
837pub struct Layer {
838    pub base: StyleSet,
839    pub variant: StyleSet,
840    pub on: StyleSet,
841    pub accent: StyleSet,
842    pub positive: StyleSet,
843    pub warning: StyleSet,
844    pub negative: StyleSet,
845}
846
847#[derive(Clone, Deserialize, Default)]
848pub struct StyleSet {
849    pub default: Style,
850    pub active: Style,
851    pub disabled: Style,
852    pub hovered: Style,
853    pub pressed: Style,
854    pub inverted: Style,
855}
856
857#[derive(Clone, Deserialize, Default)]
858pub struct Style {
859    pub background: Color,
860    pub border: Color,
861    pub foreground: Color,
862}