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