theme.rs

   1pub mod components;
   2mod theme_registry;
   3mod theme_settings;
   4pub mod ui;
   5
   6use components::{
   7    action_button::ButtonStyle, disclosure::DisclosureStyle, IconButtonStyle, ToggleIconButtonStyle,
   8};
   9use gpui::{
  10    color::Color,
  11    elements::{Border, ContainerStyle, ImageStyle, LabelStyle, Shadow, SvgStyle, TooltipStyle},
  12    fonts::{HighlightStyle, TextStyle},
  13    platform, AppContext, AssetSource, MouseState,
  14};
  15use parking_lot::Mutex;
  16use schemars::JsonSchema;
  17use serde::{de::DeserializeOwned, Deserialize};
  18use serde_json::Value;
  19use settings::SettingsStore;
  20use std::{any::Any, collections::HashMap, ops::Deref, sync::Arc};
  21use ui::{CheckboxStyle, CopilotCTAButton, IconStyle, ModalStyle};
  22
  23pub use theme_registry::*;
  24pub use theme_settings::*;
  25
  26pub fn current(cx: &AppContext) -> Arc<Theme> {
  27    settings::get::<ThemeSettings>(cx).theme.clone()
  28}
  29
  30pub fn init(source: impl AssetSource, cx: &mut AppContext) {
  31    cx.set_global(ThemeRegistry::new(source, cx.font_cache().clone()));
  32    settings::register::<ThemeSettings>(cx);
  33
  34    let mut prev_buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;
  35    cx.observe_global::<SettingsStore, _>(move |cx| {
  36        let buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;
  37        if buffer_font_size != prev_buffer_font_size {
  38            prev_buffer_font_size = buffer_font_size;
  39            reset_font_size(cx);
  40        }
  41    })
  42    .detach();
  43}
  44
  45#[derive(Deserialize, Default, JsonSchema)]
  46pub struct Theme {
  47    #[serde(default)]
  48    pub meta: ThemeMeta,
  49    pub workspace: Workspace,
  50    pub context_menu: ContextMenu,
  51    pub toolbar_dropdown_menu: DropdownMenu,
  52    pub copilot: Copilot,
  53    pub collab_panel: CollabPanel,
  54    pub project_panel: ProjectPanel,
  55    pub chat_panel: ChatPanel,
  56    pub notification_panel: NotificationPanel,
  57    pub command_palette: CommandPalette,
  58    pub picker: Picker,
  59    pub editor: Editor,
  60    pub search: Search,
  61    pub project_diagnostics: ProjectDiagnostics,
  62    pub shared_screen: ContainerStyle,
  63    pub contact_notification: ContactNotification,
  64    pub update_notification: UpdateNotification,
  65    pub simple_message_notification: MessageNotification,
  66    pub project_shared_notification: ProjectSharedNotification,
  67    pub incoming_call_notification: IncomingCallNotification,
  68    pub tooltip: TooltipStyle,
  69    pub terminal: TerminalStyle,
  70    pub assistant: AssistantStyle,
  71    pub feedback: FeedbackStyle,
  72    pub welcome: WelcomeStyle,
  73    pub titlebar: Titlebar,
  74    pub component_test: ComponentTest,
  75    // Nathan: New elements are styled in Rust, directly from the base theme.
  76    // We store it on the legacy theme so we can mix both kinds of elements during the transition.
  77    #[schemars(skip)]
  78    pub base_theme: serde_json::Value,
  79    // A place to cache deserialized base theme.
  80    #[serde(skip_deserializing)]
  81    #[schemars(skip)]
  82    pub deserialized_base_theme: Mutex<Option<Box<dyn Any + Send + Sync>>>,
  83}
  84
  85#[derive(Deserialize, Default, Clone, JsonSchema)]
  86pub struct ThemeMeta {
  87    #[serde(skip_deserializing)]
  88    pub id: usize,
  89    pub name: String,
  90    pub is_light: bool,
  91}
  92
  93#[derive(Deserialize, Default, JsonSchema)]
  94pub struct Workspace {
  95    pub background: Color,
  96    pub blank_pane: BlankPaneStyle,
  97    pub tab_bar: TabBar,
  98    pub pane_divider: Border,
  99    pub leader_border_opacity: f32,
 100    pub leader_border_width: f32,
 101    pub dock: Dock,
 102    pub status_bar: StatusBar,
 103    pub toolbar: Toolbar,
 104    pub disconnected_overlay: ContainedText,
 105    pub modal: ContainerStyle,
 106    pub zoomed_panel_foreground: ContainerStyle,
 107    pub zoomed_pane_foreground: ContainerStyle,
 108    pub zoomed_background: ContainerStyle,
 109    pub notification: ContainerStyle,
 110    pub notifications: Notifications,
 111    pub joining_project_avatar: ImageStyle,
 112    pub joining_project_message: ContainedText,
 113    pub external_location_message: ContainedText,
 114    pub drop_target_overlay_color: Color,
 115}
 116
 117#[derive(Clone, Deserialize, Default, JsonSchema)]
 118pub struct BlankPaneStyle {
 119    pub logo: SvgStyle,
 120    pub logo_shadow: SvgStyle,
 121    pub logo_container: ContainerStyle,
 122    pub keyboard_hints: ContainerStyle,
 123    pub keyboard_hint: Interactive<ContainedText>,
 124    pub keyboard_hint_width: f32,
 125}
 126
 127#[derive(Clone, Deserialize, Default, JsonSchema)]
 128pub struct Titlebar {
 129    #[serde(flatten)]
 130    pub container: ContainerStyle,
 131    pub height: f32,
 132    pub menu: TitlebarMenu,
 133    pub project_menu_button: Toggleable<Interactive<ContainedText>>,
 134    pub git_menu_button: Toggleable<Interactive<ContainedText>>,
 135    pub project_host: Interactive<ContainedText>,
 136    pub item_spacing: f32,
 137    pub face_pile_spacing: f32,
 138    pub avatar_ribbon: AvatarRibbon,
 139    pub follower_avatar_overlap: f32,
 140    pub leader_selection: ContainerStyle,
 141    pub offline_icon: OfflineIcon,
 142    pub leader_avatar: AvatarStyle,
 143    pub follower_avatar: AvatarStyle,
 144    pub inactive_avatar_grayscale: bool,
 145    pub sign_in_button: Toggleable<Interactive<ContainedText>>,
 146    pub outdated_warning: ContainedText,
 147    pub share_button: Toggleable<Interactive<ContainedText>>,
 148    pub muted: Color,
 149    pub speaking: Color,
 150    pub screen_share_button: Toggleable<Interactive<IconButton>>,
 151    pub toggle_contacts_button: Toggleable<Interactive<IconButton>>,
 152    pub toggle_microphone_button: Toggleable<Interactive<IconButton>>,
 153    pub toggle_speakers_button: Toggleable<Interactive<IconButton>>,
 154    pub leave_call_button: Interactive<IconButton>,
 155    pub toggle_contacts_badge: ContainerStyle,
 156    pub user_menu: UserMenu,
 157}
 158
 159#[derive(Clone, Deserialize, Default, JsonSchema)]
 160pub struct TitlebarMenu {
 161    pub width: f32,
 162    pub height: f32,
 163}
 164
 165#[derive(Clone, Deserialize, Default, JsonSchema)]
 166pub struct UserMenu {
 167    pub user_menu_button_online: UserMenuButton,
 168    pub user_menu_button_offline: UserMenuButton,
 169}
 170
 171#[derive(Clone, Deserialize, Default, JsonSchema)]
 172pub struct UserMenuButton {
 173    pub user_menu: Toggleable<Interactive<Icon>>,
 174    pub avatar: AvatarStyle,
 175    pub icon: Icon,
 176}
 177
 178#[derive(Copy, Clone, Deserialize, Default, JsonSchema)]
 179pub struct AvatarStyle {
 180    #[serde(flatten)]
 181    pub image: ImageStyle,
 182    pub outer_width: f32,
 183    pub outer_corner_radius: f32,
 184}
 185
 186#[derive(Deserialize, Default, Clone, JsonSchema)]
 187pub struct Copilot {
 188    pub out_link_icon: Interactive<IconStyle>,
 189    pub modal: ModalStyle,
 190    pub auth: CopilotAuth,
 191}
 192
 193#[derive(Deserialize, Default, Clone, JsonSchema)]
 194pub struct CopilotAuth {
 195    pub content_width: f32,
 196    pub prompting: CopilotAuthPrompting,
 197    pub not_authorized: CopilotAuthNotAuthorized,
 198    pub authorized: CopilotAuthAuthorized,
 199    pub cta_button: CopilotCTAButton,
 200    pub header: IconStyle,
 201}
 202
 203#[derive(Deserialize, Default, Clone, JsonSchema)]
 204pub struct CopilotAuthPrompting {
 205    pub subheading: ContainedText,
 206    pub hint: ContainedText,
 207    pub device_code: DeviceCode,
 208}
 209
 210#[derive(Deserialize, Default, Clone, JsonSchema)]
 211pub struct DeviceCode {
 212    pub text: TextStyle,
 213    pub cta: CopilotCTAButton,
 214    pub left: f32,
 215    pub left_container: ContainerStyle,
 216    pub right: f32,
 217    pub right_container: Interactive<ContainerStyle>,
 218}
 219
 220#[derive(Deserialize, Default, Clone, JsonSchema)]
 221pub struct CopilotAuthNotAuthorized {
 222    pub subheading: ContainedText,
 223    pub warning: ContainedText,
 224}
 225
 226#[derive(Deserialize, Default, Clone, JsonSchema)]
 227pub struct CopilotAuthAuthorized {
 228    pub subheading: ContainedText,
 229    pub hint: ContainedText,
 230}
 231
 232#[derive(Deserialize, Default, JsonSchema)]
 233pub struct CollabPanel {
 234    #[serde(flatten)]
 235    pub container: ContainerStyle,
 236    pub disclosure: DisclosureStyle<()>,
 237    pub list_empty_state: Toggleable<Interactive<ContainedText>>,
 238    pub list_empty_icon: Icon,
 239    pub list_empty_label_container: ContainerStyle,
 240    pub log_in_button: Interactive<ContainedText>,
 241    pub channel_editor: ContainerStyle,
 242    pub channel_hash: Icon,
 243    pub channel_note_active_color: Color,
 244    pub tabbed_modal: TabbedModal,
 245    pub contact_finder: ContactFinder,
 246    pub channel_modal: ChannelModal,
 247    pub user_query_editor: FieldEditor,
 248    pub user_query_editor_height: f32,
 249    pub leave_call_button: Toggleable<Interactive<IconButton>>,
 250    pub add_contact_button: Toggleable<Interactive<IconButton>>,
 251    pub add_channel_button: Toggleable<Interactive<IconButton>>,
 252    pub header_row: ContainedText,
 253    pub dragged_over_header: ContainerStyle,
 254    pub subheader_row: Toggleable<Interactive<ContainedText>>,
 255    pub leave_call: Interactive<ContainedText>,
 256    pub contact_row: Toggleable<Interactive<ContainerStyle>>,
 257    pub channel_row: Toggleable<Interactive<ContainerStyle>>,
 258    pub channel_name: Toggleable<ContainedText>,
 259    pub row_height: f32,
 260    pub project_row: Toggleable<Interactive<ProjectRow>>,
 261    pub tree_branch: Toggleable<Interactive<TreeBranch>>,
 262    pub contact_avatar: ImageStyle,
 263    pub channel_avatar: ImageStyle,
 264    pub extra_participant_label: ContainedText,
 265    pub contact_status_free: ContainerStyle,
 266    pub contact_status_busy: ContainerStyle,
 267    pub contact_username: ContainedText,
 268    pub contact_button: Interactive<IconButton>,
 269    pub contact_button_spacing: f32,
 270    pub channel_indent: f32,
 271    pub disabled_button: IconButton,
 272    pub section_icon_size: f32,
 273    pub calling_indicator: ContainedText,
 274    pub face_overlap: f32,
 275}
 276
 277#[derive(Deserialize, Default, JsonSchema)]
 278pub struct ComponentTest {
 279    pub button: Interactive<ButtonStyle<TextStyle>>,
 280    pub toggle: Toggleable<Interactive<ButtonStyle<TextStyle>>>,
 281    pub disclosure: DisclosureStyle<TextStyle>,
 282}
 283
 284#[derive(Deserialize, Default, JsonSchema)]
 285pub struct TabbedModal {
 286    pub tab_button: Toggleable<Interactive<ContainedText>>,
 287    pub modal: ContainerStyle,
 288    pub header: ContainerStyle,
 289    pub body: ContainerStyle,
 290    pub title: ContainedText,
 291    pub visibility_toggle: Interactive<ContainedText>,
 292    pub channel_link: Interactive<ContainedText>,
 293    pub picker: Picker,
 294    pub max_height: f32,
 295    pub max_width: f32,
 296    pub row_height: f32,
 297}
 298
 299#[derive(Deserialize, Default, JsonSchema)]
 300pub struct ChannelModal {
 301    pub contact_avatar: ImageStyle,
 302    pub contact_username: ContainerStyle,
 303    pub remove_member_button: ContainedText,
 304    pub cancel_invite_button: ContainedText,
 305    pub member_icon: IconButton,
 306    pub invitee_icon: IconButton,
 307    pub member_tag: ContainedText,
 308}
 309
 310#[derive(Deserialize, Default, JsonSchema)]
 311pub struct ProjectRow {
 312    #[serde(flatten)]
 313    pub container: ContainerStyle,
 314    pub icon: Icon,
 315    pub name: ContainedText,
 316}
 317
 318#[derive(Deserialize, Default, Clone, Copy, JsonSchema)]
 319pub struct TreeBranch {
 320    pub width: f32,
 321    pub color: Color,
 322}
 323
 324#[derive(Deserialize, Default, JsonSchema)]
 325pub struct ContactFinder {
 326    pub contact_avatar: ImageStyle,
 327    pub contact_username: ContainerStyle,
 328    pub contact_button: IconButton,
 329    pub disabled_contact_button: IconButton,
 330}
 331
 332#[derive(Deserialize, Default, JsonSchema)]
 333pub struct DropdownMenu {
 334    #[serde(flatten)]
 335    pub container: ContainerStyle,
 336    pub header: Interactive<DropdownMenuItem>,
 337    pub section_header: ContainedText,
 338    pub item: Toggleable<Interactive<DropdownMenuItem>>,
 339    pub row_height: f32,
 340}
 341
 342#[derive(Deserialize, Default, JsonSchema)]
 343pub struct DropdownMenuItem {
 344    #[serde(flatten)]
 345    pub container: ContainerStyle,
 346    #[serde(flatten)]
 347    pub text: TextStyle,
 348    pub secondary_text: Option<TextStyle>,
 349    #[serde(default)]
 350    pub secondary_text_spacing: f32,
 351}
 352
 353#[derive(Clone, Deserialize, Default, JsonSchema)]
 354pub struct TabBar {
 355    #[serde(flatten)]
 356    pub container: ContainerStyle,
 357    pub pane_button: Toggleable<Interactive<IconButton>>,
 358    pub pane_button_container: ContainerStyle,
 359    pub active_pane: TabStyles,
 360    pub inactive_pane: TabStyles,
 361    pub dragged_tab: Tab,
 362    pub height: f32,
 363    pub nav_button: Interactive<IconButton>,
 364}
 365
 366impl TabBar {
 367    pub fn tab_style(&self, pane_active: bool, tab_active: bool) -> &Tab {
 368        let tabs = if pane_active {
 369            &self.active_pane
 370        } else {
 371            &self.inactive_pane
 372        };
 373
 374        if tab_active {
 375            &tabs.active_tab
 376        } else {
 377            &tabs.inactive_tab
 378        }
 379    }
 380}
 381
 382#[derive(Clone, Deserialize, Default, JsonSchema)]
 383pub struct TabStyles {
 384    pub active_tab: Tab,
 385    pub inactive_tab: Tab,
 386}
 387
 388#[derive(Clone, Deserialize, Default, JsonSchema)]
 389pub struct AvatarRibbon {
 390    #[serde(flatten)]
 391    pub container: ContainerStyle,
 392    pub width: f32,
 393    pub height: f32,
 394}
 395
 396#[derive(Clone, Deserialize, Default, JsonSchema)]
 397pub struct OfflineIcon {
 398    #[serde(flatten)]
 399    pub container: ContainerStyle,
 400    pub width: f32,
 401    pub color: Color,
 402}
 403
 404#[derive(Clone, Deserialize, Default, JsonSchema)]
 405pub struct Tab {
 406    pub height: f32,
 407    #[serde(flatten)]
 408    pub container: ContainerStyle,
 409    #[serde(flatten)]
 410    pub label: LabelStyle,
 411    pub description: ContainedText,
 412    pub spacing: f32,
 413    pub close_icon_width: f32,
 414    pub type_icon_width: f32,
 415    pub icon_close: Color,
 416    pub icon_close_active: Color,
 417    pub icon_dirty: Color,
 418    pub icon_conflict: Color,
 419    pub git: GitProjectStatus,
 420}
 421
 422#[derive(Clone, Deserialize, Default, JsonSchema)]
 423pub struct Toolbar {
 424    #[serde(flatten)]
 425    pub container: ContainerStyle,
 426    pub height: f32,
 427    pub item_spacing: f32,
 428    pub toggleable_tool: Toggleable<Interactive<IconButton>>,
 429    pub toggleable_text_tool: Toggleable<Interactive<ContainedText>>,
 430    pub breadcrumb_height: f32,
 431    pub breadcrumbs: Interactive<ContainedText>,
 432}
 433
 434#[derive(Clone, Deserialize, Default, JsonSchema)]
 435pub struct Notifications {
 436    #[serde(flatten)]
 437    pub container: ContainerStyle,
 438    pub width: f32,
 439}
 440
 441#[derive(Clone, Deserialize, Default, JsonSchema)]
 442pub struct Search {
 443    #[serde(flatten)]
 444    pub container: ContainerStyle,
 445    pub editor: FindEditor,
 446    pub invalid_editor: ContainerStyle,
 447    pub option_button_group: ContainerStyle,
 448    pub include_exclude_editor: FindEditor,
 449    pub invalid_include_exclude_editor: ContainerStyle,
 450    pub include_exclude_inputs: ContainedText,
 451    pub option_button_component: ToggleIconButtonStyle,
 452    pub match_background: Color,
 453    pub match_index: ContainedText,
 454    pub major_results_status: TextStyle,
 455    pub minor_results_status: TextStyle,
 456    pub editor_icon: IconStyle,
 457    pub mode_button: Toggleable<Interactive<ContainedText>>,
 458    pub nav_button: Toggleable<Interactive<ContainedLabel>>,
 459    pub search_bar_row_height: f32,
 460    pub search_row_spacing: f32,
 461    pub option_button_height: f32,
 462    pub modes_container: ContainerStyle,
 463    pub replace_icon: IconStyle,
 464    // Used for filters and replace
 465    pub option_button: Toggleable<Interactive<IconButton>>,
 466    pub action_button: IconButtonStyle,
 467}
 468
 469#[derive(Clone, Deserialize, Default, JsonSchema)]
 470pub struct FindEditor {
 471    #[serde(flatten)]
 472    pub input: FieldEditor,
 473    pub min_width: f32,
 474    pub max_width: f32,
 475}
 476
 477#[derive(Deserialize, Default, JsonSchema)]
 478pub struct StatusBar {
 479    #[serde(flatten)]
 480    pub container: ContainerStyle,
 481    pub height: f32,
 482    pub item_spacing: f32,
 483    pub cursor_position: TextStyle,
 484    pub vim_mode_indicator: ContainedText,
 485    pub active_language: Interactive<ContainedText>,
 486    pub auto_update_progress_message: TextStyle,
 487    pub auto_update_done_message: TextStyle,
 488    pub lsp_status: Interactive<StatusBarLspStatus>,
 489    pub panel_buttons: StatusBarPanelButtons,
 490    pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
 491    pub diagnostic_message: Interactive<ContainedText>,
 492}
 493
 494#[derive(Deserialize, Default, JsonSchema)]
 495pub struct StatusBarPanelButtons {
 496    pub group_left: ContainerStyle,
 497    pub group_bottom: ContainerStyle,
 498    pub group_right: ContainerStyle,
 499    pub button: Toggleable<Interactive<PanelButton>>,
 500}
 501
 502#[derive(Deserialize, Default, JsonSchema)]
 503pub struct StatusBarDiagnosticSummary {
 504    pub container_ok: ContainerStyle,
 505    pub container_warning: ContainerStyle,
 506    pub container_error: ContainerStyle,
 507    pub text: TextStyle,
 508    pub icon_color_ok: Color,
 509    pub icon_color_warning: Color,
 510    pub icon_color_error: Color,
 511    pub height: f32,
 512    pub icon_width: f32,
 513    pub icon_spacing: f32,
 514    pub summary_spacing: f32,
 515}
 516
 517#[derive(Deserialize, Default, JsonSchema)]
 518pub struct StatusBarLspStatus {
 519    #[serde(flatten)]
 520    pub container: ContainerStyle,
 521    pub height: f32,
 522    pub icon_spacing: f32,
 523    pub icon_color: Color,
 524    pub icon_width: f32,
 525    pub message: TextStyle,
 526}
 527
 528#[derive(Deserialize, Default, JsonSchema)]
 529pub struct Dock {
 530    pub left: ContainerStyle,
 531    pub bottom: ContainerStyle,
 532    pub right: ContainerStyle,
 533}
 534
 535#[derive(Clone, Deserialize, Default, JsonSchema)]
 536pub struct PanelButton {
 537    #[serde(flatten)]
 538    pub container: ContainerStyle,
 539    pub icon_color: Color,
 540    pub icon_size: f32,
 541    pub label: ContainedText,
 542}
 543
 544#[derive(Deserialize, Default, JsonSchema)]
 545pub struct ProjectPanel {
 546    #[serde(flatten)]
 547    pub container: ContainerStyle,
 548    pub entry: Toggleable<Interactive<ProjectPanelEntry>>,
 549    pub dragged_entry: ProjectPanelEntry,
 550    pub ignored_entry: Toggleable<Interactive<ProjectPanelEntry>>,
 551    pub cut_entry: Toggleable<Interactive<ProjectPanelEntry>>,
 552    pub filename_editor: FieldEditor,
 553    pub indent_width: f32,
 554    pub open_project_button: Interactive<ContainedText>,
 555}
 556
 557#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 558pub struct ProjectPanelEntry {
 559    pub height: f32,
 560    #[serde(flatten)]
 561    pub container: ContainerStyle,
 562    pub text: TextStyle,
 563    pub icon_size: f32,
 564    pub icon_color: Color,
 565    pub chevron_color: Color,
 566    pub chevron_size: f32,
 567    pub icon_spacing: f32,
 568    pub status: EntryStatus,
 569}
 570
 571#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 572pub struct EntryStatus {
 573    pub git: GitProjectStatus,
 574}
 575
 576#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 577pub struct GitProjectStatus {
 578    pub modified: Color,
 579    pub inserted: Color,
 580    pub conflict: Color,
 581}
 582
 583#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 584pub struct ContextMenu {
 585    #[serde(flatten)]
 586    pub container: ContainerStyle,
 587    pub item: Toggleable<Interactive<ContextMenuItem>>,
 588    pub keystroke_margin: f32,
 589    pub separator: ContainerStyle,
 590}
 591
 592#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 593pub struct ContextMenuItem {
 594    #[serde(flatten)]
 595    pub container: ContainerStyle,
 596    pub label: TextStyle,
 597    pub keystroke: ContainedText,
 598    pub icon_width: f32,
 599    pub icon_spacing: f32,
 600}
 601
 602#[derive(Debug, Deserialize, Default, JsonSchema)]
 603pub struct CommandPalette {
 604    pub key: Toggleable<ContainedLabel>,
 605    pub keystroke_spacing: f32,
 606}
 607
 608#[derive(Deserialize, Default, JsonSchema)]
 609pub struct InviteLink {
 610    #[serde(flatten)]
 611    pub container: ContainerStyle,
 612    #[serde(flatten)]
 613    pub label: LabelStyle,
 614    pub icon: Icon,
 615}
 616
 617#[derive(Deserialize, Clone, Copy, Default, JsonSchema)]
 618pub struct Icon {
 619    #[serde(flatten)]
 620    pub container: ContainerStyle,
 621    pub color: Color,
 622    pub width: f32,
 623}
 624
 625#[derive(Deserialize, Clone, Copy, Default, JsonSchema)]
 626pub struct IconButton {
 627    #[serde(flatten)]
 628    pub container: ContainerStyle,
 629    pub color: Color,
 630    pub icon_width: f32,
 631    pub button_width: f32,
 632}
 633
 634#[derive(Deserialize, Default, JsonSchema)]
 635pub struct ChatPanel {
 636    #[serde(flatten)]
 637    pub container: ContainerStyle,
 638    pub list: ContainerStyle,
 639    pub channel_select: ChannelSelect,
 640    pub input_editor: FieldEditor,
 641    pub avatar: AvatarStyle,
 642    pub avatar_container: ContainerStyle,
 643    pub rich_text: RichTextStyle,
 644    pub message_sender: ContainedText,
 645    pub message_timestamp: ContainedText,
 646    pub message: Interactive<ContainerStyle>,
 647    pub continuation_message: Interactive<ContainerStyle>,
 648    pub pending_message: Interactive<ContainerStyle>,
 649    pub last_message_bottom_spacing: f32,
 650    pub sign_in_prompt: Interactive<TextStyle>,
 651    pub icon_button: Interactive<IconButton>,
 652}
 653
 654#[derive(Clone, Deserialize, Default, JsonSchema)]
 655pub struct RichTextStyle {
 656    pub text: TextStyle,
 657    pub mention_highlight: HighlightStyle,
 658    pub mention_background: Option<Color>,
 659    pub self_mention_highlight: HighlightStyle,
 660    pub self_mention_background: Option<Color>,
 661    pub code_background: Option<Color>,
 662}
 663
 664#[derive(Deserialize, Default, JsonSchema)]
 665pub struct NotificationPanel {
 666    #[serde(flatten)]
 667    pub container: ContainerStyle,
 668    pub title: ContainedText,
 669    pub title_icon: SvgStyle,
 670    pub title_height: f32,
 671    pub list: ContainerStyle,
 672    pub avatar: AvatarStyle,
 673    pub avatar_container: ContainerStyle,
 674    pub sign_in_prompt: Interactive<TextStyle>,
 675    pub icon_button: Interactive<IconButton>,
 676    pub unread_text: ContainedText,
 677    pub read_text: ContainedText,
 678    pub timestamp: ContainedText,
 679    pub button: Interactive<ContainedText>,
 680}
 681
 682#[derive(Deserialize, Default, JsonSchema)]
 683pub struct ChannelSelect {
 684    #[serde(flatten)]
 685    pub container: ContainerStyle,
 686    pub header: ChannelName,
 687    pub item: ChannelName,
 688    pub active_item: ChannelName,
 689    pub hovered_item: ChannelName,
 690    pub menu: ContainerStyle,
 691}
 692
 693#[derive(Deserialize, Default, JsonSchema)]
 694pub struct ChannelName {
 695    #[serde(flatten)]
 696    pub container: ContainerStyle,
 697    pub hash: ContainedText,
 698    pub name: TextStyle,
 699}
 700
 701#[derive(Clone, Deserialize, Default, JsonSchema)]
 702pub struct Picker {
 703    #[serde(flatten)]
 704    pub container: ContainerStyle,
 705    pub empty_container: ContainerStyle,
 706    pub input_editor: FieldEditor,
 707    pub empty_input_editor: FieldEditor,
 708    pub no_matches: ContainedLabel,
 709    pub item: Toggleable<Interactive<ContainedLabel>>,
 710    pub header: ContainedLabel,
 711    pub footer: Interactive<ContainedLabel>,
 712}
 713
 714#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 715pub struct ContainedText {
 716    #[serde(flatten)]
 717    pub container: ContainerStyle,
 718    #[serde(flatten)]
 719    pub text: TextStyle,
 720}
 721
 722#[derive(Clone, Debug, Deserialize, Default, JsonSchema)]
 723pub struct ContainedLabel {
 724    #[serde(flatten)]
 725    pub container: ContainerStyle,
 726    #[serde(flatten)]
 727    pub label: LabelStyle,
 728}
 729
 730#[derive(Clone, Deserialize, Default, JsonSchema)]
 731pub struct ProjectDiagnostics {
 732    #[serde(flatten)]
 733    pub container: ContainerStyle,
 734    pub empty_message: TextStyle,
 735    pub tab_icon_width: f32,
 736    pub tab_icon_spacing: f32,
 737    pub tab_summary_spacing: f32,
 738}
 739
 740#[derive(Deserialize, Default, JsonSchema)]
 741pub struct ContactNotification {
 742    pub header_avatar: ImageStyle,
 743    pub header_message: ContainedText,
 744    pub header_height: f32,
 745    pub body_message: ContainedText,
 746    pub button: Interactive<ContainedText>,
 747    pub dismiss_button: Interactive<IconButton>,
 748}
 749
 750#[derive(Deserialize, Default, JsonSchema)]
 751pub struct UpdateNotification {
 752    pub message: ContainedText,
 753    pub action_message: Interactive<ContainedText>,
 754    pub dismiss_button: Interactive<IconButton>,
 755}
 756
 757#[derive(Deserialize, Default, JsonSchema)]
 758pub struct MessageNotification {
 759    pub message: ContainedText,
 760    pub action_message: Interactive<ContainedText>,
 761    pub dismiss_button: Interactive<IconButton>,
 762}
 763
 764#[derive(Deserialize, Default, JsonSchema)]
 765pub struct ProjectSharedNotification {
 766    pub window_height: f32,
 767    pub window_width: f32,
 768    #[serde(default)]
 769    pub background: Color,
 770    pub owner_container: ContainerStyle,
 771    pub owner_avatar: ImageStyle,
 772    pub owner_metadata: ContainerStyle,
 773    pub owner_username: ContainedText,
 774    pub message: ContainedText,
 775    pub worktree_roots: ContainedText,
 776    pub button_width: f32,
 777    pub open_button: ContainedText,
 778    pub dismiss_button: ContainedText,
 779}
 780
 781#[derive(Deserialize, Default, JsonSchema)]
 782pub struct IncomingCallNotification {
 783    pub window_height: f32,
 784    pub window_width: f32,
 785    #[serde(default)]
 786    pub background: Color,
 787    pub caller_container: ContainerStyle,
 788    pub caller_avatar: ImageStyle,
 789    pub caller_metadata: ContainerStyle,
 790    pub caller_username: ContainedText,
 791    pub caller_message: ContainedText,
 792    pub worktree_roots: ContainedText,
 793    pub button_width: f32,
 794    pub accept_button: ContainedText,
 795    pub decline_button: ContainedText,
 796}
 797
 798#[derive(Clone, Deserialize, Default, JsonSchema)]
 799pub struct Editor {
 800    pub text_color: Color,
 801    #[serde(default)]
 802    pub background: Color,
 803    pub selection: SelectionStyle,
 804    pub gutter_background: Color,
 805    pub gutter_padding_factor: f32,
 806    pub active_line_background: Color,
 807    pub highlighted_line_background: Color,
 808    pub rename_fade: f32,
 809    pub document_highlight_read_background: Color,
 810    pub document_highlight_write_background: Color,
 811    pub diff: DiffStyle,
 812    pub wrap_guide: Color,
 813    pub active_wrap_guide: Color,
 814    pub line_number: Color,
 815    pub line_number_active: Color,
 816    pub guest_selections: Vec<SelectionStyle>,
 817    pub absent_selection: SelectionStyle,
 818    pub syntax: Arc<SyntaxTheme>,
 819    pub hint: HighlightStyle,
 820    pub suggestion: HighlightStyle,
 821    pub diagnostic_path_header: DiagnosticPathHeader,
 822    pub diagnostic_header: DiagnosticHeader,
 823    pub error_diagnostic: DiagnosticStyle,
 824    pub invalid_error_diagnostic: DiagnosticStyle,
 825    pub warning_diagnostic: DiagnosticStyle,
 826    pub invalid_warning_diagnostic: DiagnosticStyle,
 827    pub information_diagnostic: DiagnosticStyle,
 828    pub invalid_information_diagnostic: DiagnosticStyle,
 829    pub hint_diagnostic: DiagnosticStyle,
 830    pub invalid_hint_diagnostic: DiagnosticStyle,
 831    pub autocomplete: AutocompleteStyle,
 832    pub code_actions: CodeActions,
 833    pub folds: Folds,
 834    pub unnecessary_code_fade: f32,
 835    pub hover_popover: HoverPopover,
 836    pub link_definition: HighlightStyle,
 837    pub composition_mark: HighlightStyle,
 838    pub jump_icon: Interactive<IconButton>,
 839    pub scrollbar: Scrollbar,
 840    pub whitespace: Color,
 841}
 842
 843#[derive(Clone, Deserialize, Default, JsonSchema)]
 844pub struct Scrollbar {
 845    pub track: ContainerStyle,
 846    pub thumb: ContainerStyle,
 847    pub width: f32,
 848    pub min_height_factor: f32,
 849    pub git: BufferGitDiffColors,
 850    pub selections: Color,
 851}
 852
 853#[derive(Clone, Deserialize, Default, JsonSchema)]
 854pub struct BufferGitDiffColors {
 855    pub inserted: Color,
 856    pub modified: Color,
 857    pub deleted: Color,
 858}
 859
 860#[derive(Clone, Deserialize, Default, JsonSchema)]
 861pub struct DiagnosticPathHeader {
 862    #[serde(flatten)]
 863    pub container: ContainerStyle,
 864    pub filename: ContainedText,
 865    pub path: ContainedText,
 866    pub text_scale_factor: f32,
 867}
 868
 869#[derive(Clone, Deserialize, Default, JsonSchema)]
 870pub struct DiagnosticHeader {
 871    #[serde(flatten)]
 872    pub container: ContainerStyle,
 873    pub source: ContainedLabel,
 874    pub message: ContainedLabel,
 875    pub code: ContainedText,
 876    pub text_scale_factor: f32,
 877    pub icon_width_factor: f32,
 878}
 879
 880#[derive(Clone, Deserialize, Default, JsonSchema)]
 881pub struct DiagnosticStyle {
 882    pub message: LabelStyle,
 883    #[serde(default)]
 884    pub header: ContainerStyle,
 885    pub text_scale_factor: f32,
 886}
 887
 888#[derive(Clone, Deserialize, Default, JsonSchema)]
 889pub struct AutocompleteStyle {
 890    #[serde(flatten)]
 891    pub container: ContainerStyle,
 892    pub item: ContainerStyle,
 893    pub selected_item: ContainerStyle,
 894    pub hovered_item: ContainerStyle,
 895    pub match_highlight: HighlightStyle,
 896    pub completion_min_width: f32,
 897    pub completion_max_width: f32,
 898    pub inline_docs_container: ContainerStyle,
 899    pub inline_docs_color: Color,
 900    pub inline_docs_size_percent: f32,
 901    pub alongside_docs_max_width: f32,
 902    pub alongside_docs_container: ContainerStyle,
 903}
 904
 905#[derive(Clone, Copy, Default, Deserialize, JsonSchema)]
 906pub struct SelectionStyle {
 907    pub cursor: Color,
 908    pub selection: Color,
 909}
 910
 911#[derive(Clone, Deserialize, Default, JsonSchema)]
 912pub struct FieldEditor {
 913    #[serde(flatten)]
 914    pub container: ContainerStyle,
 915    pub text: TextStyle,
 916    #[serde(default)]
 917    pub placeholder_text: Option<TextStyle>,
 918    pub selection: SelectionStyle,
 919}
 920
 921#[derive(Clone, Deserialize, Default, JsonSchema)]
 922pub struct InteractiveColor {
 923    pub color: Color,
 924}
 925
 926#[derive(Clone, Deserialize, Default, JsonSchema)]
 927pub struct CodeActions {
 928    #[serde(default)]
 929    pub indicator: Toggleable<Interactive<InteractiveColor>>,
 930    pub vertical_scale: f32,
 931}
 932
 933#[derive(Clone, Deserialize, Default, JsonSchema)]
 934pub struct Folds {
 935    pub indicator: Toggleable<Interactive<InteractiveColor>>,
 936    pub ellipses: FoldEllipses,
 937    pub fold_background: Color,
 938    pub icon_margin_scale: f32,
 939    pub folded_icon: String,
 940    pub foldable_icon: String,
 941}
 942
 943#[derive(Clone, Deserialize, Default, JsonSchema)]
 944pub struct FoldEllipses {
 945    pub text_color: Color,
 946    pub background: Interactive<InteractiveColor>,
 947    pub corner_radius_factor: f32,
 948}
 949
 950#[derive(Clone, Deserialize, Default, JsonSchema)]
 951pub struct DiffStyle {
 952    pub inserted: Color,
 953    pub modified: Color,
 954    pub deleted: Color,
 955    pub removed_width_em: f32,
 956    pub width_em: f32,
 957    pub corner_radius: f32,
 958}
 959
 960#[derive(Debug, Default, Clone, Copy, JsonSchema)]
 961pub struct Interactive<T> {
 962    pub default: T,
 963    pub hovered: Option<T>,
 964    pub clicked: Option<T>,
 965    pub disabled: Option<T>,
 966}
 967
 968impl<T> Deref for Interactive<T> {
 969    type Target = T;
 970
 971    fn deref(&self) -> &Self::Target {
 972        &self.default
 973    }
 974}
 975
 976impl Interactive<()> {
 977    pub fn new_blank() -> Self {
 978        Self {
 979            default: (),
 980            hovered: None,
 981            clicked: None,
 982            disabled: None,
 983        }
 984    }
 985}
 986
 987#[derive(Clone, Copy, Debug, Default, Deserialize, JsonSchema)]
 988pub struct Toggleable<T> {
 989    active: T,
 990    inactive: T,
 991}
 992
 993impl<T> Deref for Toggleable<T> {
 994    type Target = T;
 995
 996    fn deref(&self) -> &Self::Target {
 997        &self.inactive
 998    }
 999}
1000
1001impl Toggleable<()> {
1002    pub fn new_blank() -> Self {
1003        Self {
1004            active: (),
1005            inactive: (),
1006        }
1007    }
1008}
1009
1010impl<T> Toggleable<T> {
1011    pub fn new(active: T, inactive: T) -> Self {
1012        Self { active, inactive }
1013    }
1014    pub fn in_state(&self, active: bool) -> &T {
1015        if active {
1016            &self.active
1017        } else {
1018            &self.inactive
1019        }
1020    }
1021    pub fn active_state(&self) -> &T {
1022        self.in_state(true)
1023    }
1024
1025    pub fn inactive_state(&self) -> &T {
1026        self.in_state(false)
1027    }
1028}
1029
1030impl<T> Interactive<T> {
1031    pub fn style_for(&self, state: &mut MouseState) -> &T {
1032        if state.clicked() == Some(platform::MouseButton::Left) && self.clicked.is_some() {
1033            self.clicked.as_ref().unwrap()
1034        } else if state.hovered() {
1035            self.hovered.as_ref().unwrap_or(&self.default)
1036        } else {
1037            &self.default
1038        }
1039    }
1040    pub fn disabled_style(&self) -> &T {
1041        self.disabled.as_ref().unwrap_or(&self.default)
1042    }
1043}
1044
1045impl<T> Toggleable<Interactive<T>> {
1046    pub fn style_for(&self, active: bool, state: &mut MouseState) -> &T {
1047        self.in_state(active).style_for(state)
1048    }
1049
1050    pub fn default_style(&self) -> &T {
1051        &self.inactive.default
1052    }
1053}
1054
1055impl<'de, T: DeserializeOwned> Deserialize<'de> for Interactive<T> {
1056    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1057    where
1058        D: serde::Deserializer<'de>,
1059    {
1060        #[derive(Deserialize)]
1061        struct Helper {
1062            default: Value,
1063            hovered: Option<Value>,
1064            clicked: Option<Value>,
1065            disabled: Option<Value>,
1066        }
1067
1068        let json = Helper::deserialize(deserializer)?;
1069
1070        let deserialize_state = |state_json: Option<Value>| -> Result<Option<T>, D::Error> {
1071            if let Some(mut state_json) = state_json {
1072                if let Value::Object(state_json) = &mut state_json {
1073                    if let Value::Object(default) = &json.default {
1074                        for (key, value) in default {
1075                            if !state_json.contains_key(key) {
1076                                state_json.insert(key.clone(), value.clone());
1077                            }
1078                        }
1079                    }
1080                }
1081                Ok(Some(
1082                    serde_json::from_value::<T>(state_json).map_err(serde::de::Error::custom)?,
1083                ))
1084            } else {
1085                Ok(None)
1086            }
1087        };
1088
1089        let hovered = deserialize_state(json.hovered)?;
1090        let clicked = deserialize_state(json.clicked)?;
1091        let disabled = deserialize_state(json.disabled)?;
1092        let default = serde_json::from_value(json.default).map_err(serde::de::Error::custom)?;
1093
1094        Ok(Interactive {
1095            default,
1096            hovered,
1097            clicked,
1098            disabled,
1099        })
1100    }
1101}
1102
1103impl Editor {
1104    pub fn selection_style_for_room_participant(&self, participant_index: u32) -> SelectionStyle {
1105        if self.guest_selections.is_empty() {
1106            return SelectionStyle::default();
1107        }
1108        let style_ix = participant_index as usize % self.guest_selections.len();
1109        self.guest_selections[style_ix]
1110    }
1111}
1112
1113#[derive(Default, JsonSchema)]
1114pub struct SyntaxTheme {
1115    pub highlights: Vec<(String, HighlightStyle)>,
1116}
1117
1118impl SyntaxTheme {
1119    pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
1120        Self { highlights }
1121    }
1122}
1123
1124impl<'de> Deserialize<'de> for SyntaxTheme {
1125    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1126    where
1127        D: serde::Deserializer<'de>,
1128    {
1129        let syntax_data: HashMap<String, HighlightStyle> = Deserialize::deserialize(deserializer)?;
1130
1131        let mut result = Self::new(Vec::new());
1132        for (key, style) in syntax_data {
1133            match result
1134                .highlights
1135                .binary_search_by(|(needle, _)| needle.cmp(&key))
1136            {
1137                Ok(i) | Err(i) => {
1138                    result.highlights.insert(i, (key, style));
1139                }
1140            }
1141        }
1142
1143        Ok(result)
1144    }
1145}
1146
1147#[derive(Clone, Deserialize, Default, JsonSchema)]
1148pub struct HoverPopover {
1149    pub container: ContainerStyle,
1150    pub info_container: ContainerStyle,
1151    pub warning_container: ContainerStyle,
1152    pub error_container: ContainerStyle,
1153    pub block_style: ContainerStyle,
1154    pub prose: TextStyle,
1155    pub diagnostic_source_highlight: HighlightStyle,
1156    pub highlight: Color,
1157}
1158
1159#[derive(Clone, Deserialize, Default, JsonSchema)]
1160pub struct TerminalStyle {
1161    pub black: Color,
1162    pub red: Color,
1163    pub green: Color,
1164    pub yellow: Color,
1165    pub blue: Color,
1166    pub magenta: Color,
1167    pub cyan: Color,
1168    pub white: Color,
1169    pub bright_black: Color,
1170    pub bright_red: Color,
1171    pub bright_green: Color,
1172    pub bright_yellow: Color,
1173    pub bright_blue: Color,
1174    pub bright_magenta: Color,
1175    pub bright_cyan: Color,
1176    pub bright_white: Color,
1177    pub foreground: Color,
1178    pub background: Color,
1179    pub modal_background: Color,
1180    pub cursor: Color,
1181    pub dim_black: Color,
1182    pub dim_red: Color,
1183    pub dim_green: Color,
1184    pub dim_yellow: Color,
1185    pub dim_blue: Color,
1186    pub dim_magenta: Color,
1187    pub dim_cyan: Color,
1188    pub dim_white: Color,
1189    pub bright_foreground: Color,
1190    pub dim_foreground: Color,
1191}
1192
1193#[derive(Clone, Deserialize, Default, JsonSchema)]
1194pub struct AssistantStyle {
1195    pub container: ContainerStyle,
1196    pub hamburger_button: Interactive<IconStyle>,
1197    pub split_button: Interactive<IconStyle>,
1198    pub assist_button: Interactive<IconStyle>,
1199    pub quote_button: Interactive<IconStyle>,
1200    pub zoom_in_button: Interactive<IconStyle>,
1201    pub zoom_out_button: Interactive<IconStyle>,
1202    pub plus_button: Interactive<IconStyle>,
1203    pub title: ContainedText,
1204    pub message_header: ContainerStyle,
1205    pub sent_at: ContainedText,
1206    pub user_sender: Interactive<ContainedText>,
1207    pub assistant_sender: Interactive<ContainedText>,
1208    pub system_sender: Interactive<ContainedText>,
1209    pub model: Interactive<ContainedText>,
1210    pub remaining_tokens: ContainedText,
1211    pub low_remaining_tokens: ContainedText,
1212    pub no_remaining_tokens: ContainedText,
1213    pub error_icon: Icon,
1214    pub api_key_editor: FieldEditor,
1215    pub api_key_prompt: ContainedText,
1216    pub saved_conversation: SavedConversation,
1217    pub inline: InlineAssistantStyle,
1218}
1219
1220#[derive(Clone, Deserialize, Default, JsonSchema)]
1221pub struct InlineAssistantStyle {
1222    #[serde(flatten)]
1223    pub container: ContainerStyle,
1224    pub editor: FieldEditor,
1225    pub disabled_editor: FieldEditor,
1226    pub pending_edit_background: Color,
1227    pub include_conversation: ToggleIconButtonStyle,
1228    pub retrieve_context: ToggleIconButtonStyle,
1229    pub context_status: ContextStatusStyle,
1230}
1231
1232#[derive(Clone, Deserialize, Default, JsonSchema)]
1233pub struct ContextStatusStyle {
1234    pub error_icon: Icon,
1235    pub in_progress_icon: Icon,
1236    pub complete_icon: Icon,
1237}
1238
1239#[derive(Clone, Deserialize, Default, JsonSchema)]
1240pub struct Contained<T> {
1241    container: ContainerStyle,
1242    contained: T,
1243}
1244
1245#[derive(Clone, Deserialize, Default, JsonSchema)]
1246pub struct SavedConversation {
1247    pub container: Interactive<ContainerStyle>,
1248    pub saved_at: ContainedText,
1249    pub title: ContainedText,
1250}
1251
1252#[derive(Clone, Deserialize, Default, JsonSchema)]
1253pub struct FeedbackStyle {
1254    pub submit_button: Interactive<ContainedText>,
1255    pub button_margin: f32,
1256    pub info_text_default: ContainedText,
1257    pub link_text_default: ContainedText,
1258    pub link_text_hover: ContainedText,
1259}
1260
1261#[derive(Clone, Deserialize, Default, JsonSchema)]
1262pub struct WelcomeStyle {
1263    pub page_width: f32,
1264    pub logo: SvgStyle,
1265    pub logo_subheading: ContainedText,
1266    pub usage_note: ContainedText,
1267    pub checkbox: CheckboxStyle,
1268    pub checkbox_container: ContainerStyle,
1269    pub button: Interactive<ContainedText>,
1270    pub button_group: ContainerStyle,
1271    pub heading_group: ContainerStyle,
1272    pub checkbox_group: ContainerStyle,
1273}
1274
1275#[derive(Clone, Deserialize, Default, JsonSchema)]
1276pub struct ColorScheme {
1277    pub name: String,
1278    pub is_light: bool,
1279    pub ramps: RampSet,
1280    pub lowest: Layer,
1281    pub middle: Layer,
1282    pub highest: Layer,
1283
1284    pub popover_shadow: Shadow,
1285    pub modal_shadow: Shadow,
1286
1287    pub players: Vec<Player>,
1288}
1289
1290#[derive(Clone, Deserialize, Default, JsonSchema)]
1291pub struct Player {
1292    pub cursor: Color,
1293    pub selection: Color,
1294}
1295
1296#[derive(Clone, Deserialize, Default, JsonSchema)]
1297pub struct RampSet {
1298    pub neutral: Vec<Color>,
1299    pub red: Vec<Color>,
1300    pub orange: Vec<Color>,
1301    pub yellow: Vec<Color>,
1302    pub green: Vec<Color>,
1303    pub cyan: Vec<Color>,
1304    pub blue: Vec<Color>,
1305    pub violet: Vec<Color>,
1306    pub magenta: Vec<Color>,
1307}
1308
1309#[derive(Clone, Deserialize, Default, JsonSchema)]
1310pub struct Layer {
1311    pub base: StyleSet,
1312    pub variant: StyleSet,
1313    pub on: StyleSet,
1314    pub accent: StyleSet,
1315    pub positive: StyleSet,
1316    pub warning: StyleSet,
1317    pub negative: StyleSet,
1318}
1319
1320#[derive(Clone, Deserialize, Default, JsonSchema)]
1321pub struct StyleSet {
1322    pub default: Style,
1323    pub active: Style,
1324    pub disabled: Style,
1325    pub hovered: Style,
1326    pub pressed: Style,
1327    pub inverted: Style,
1328}
1329
1330#[derive(Clone, Deserialize, Default, JsonSchema)]
1331pub struct Style {
1332    pub background: Color,
1333    pub border: Color,
1334    pub foreground: Color,
1335}