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