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