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