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