theme.rs

   1use collections::{HashMap, IndexMap};
   2use gpui::{FontFallbacks, FontFeatures, FontStyle, FontWeight, SharedString};
   3use schemars::{JsonSchema, JsonSchema_repr};
   4use serde::{Deserialize, Deserializer, Serialize};
   5use serde_json::Value;
   6use serde_repr::{Deserialize_repr, Serialize_repr};
   7use settings_macros::MergeFrom;
   8use std::{fmt::Display, sync::Arc};
   9
  10use serde_with::skip_serializing_none;
  11
  12use crate::serialize_f32_with_two_decimal_places;
  13
  14/// Settings for rendering text in UI and text buffers.
  15
  16#[skip_serializing_none]
  17#[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
  18pub struct ThemeSettingsContent {
  19    /// The default font size for text in the UI.
  20    #[serde(default)]
  21    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
  22    pub ui_font_size: Option<f32>,
  23    /// The name of a font to use for rendering in the UI.
  24    #[serde(default)]
  25    pub ui_font_family: Option<FontFamilyName>,
  26    /// The font fallbacks to use for rendering in the UI.
  27    #[serde(default)]
  28    #[schemars(default = "default_font_fallbacks")]
  29    #[schemars(extend("uniqueItems" = true))]
  30    pub ui_font_fallbacks: Option<Vec<FontFamilyName>>,
  31    /// The OpenType features to enable for text in the UI.
  32    #[serde(default)]
  33    #[schemars(default = "default_font_features")]
  34    pub ui_font_features: Option<FontFeatures>,
  35    /// The weight of the UI font in CSS units from 100 to 900.
  36    #[serde(default)]
  37    #[schemars(default = "default_buffer_font_weight")]
  38    pub ui_font_weight: Option<FontWeight>,
  39    /// The name of a font to use for rendering in text buffers.
  40    #[serde(default)]
  41    pub buffer_font_family: Option<FontFamilyName>,
  42    /// The font fallbacks to use for rendering in text buffers.
  43    #[serde(default)]
  44    #[schemars(extend("uniqueItems" = true))]
  45    pub buffer_font_fallbacks: Option<Vec<FontFamilyName>>,
  46    /// The default font size for rendering in text buffers.
  47    #[serde(default)]
  48    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
  49    pub buffer_font_size: Option<f32>,
  50    /// The weight of the editor font in CSS units from 100 to 900.
  51    #[serde(default)]
  52    #[schemars(default = "default_buffer_font_weight")]
  53    pub buffer_font_weight: Option<FontWeight>,
  54    /// The buffer's line height.
  55    #[serde(default)]
  56    pub buffer_line_height: Option<BufferLineHeight>,
  57    /// The OpenType features to enable for rendering in text buffers.
  58    #[serde(default)]
  59    #[schemars(default = "default_font_features")]
  60    pub buffer_font_features: Option<FontFeatures>,
  61    /// The font size for agent responses in the agent panel. Falls back to the UI font size if unset.
  62    #[serde(default)]
  63    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
  64    pub agent_ui_font_size: Option<f32>,
  65    /// The font size for user messages in the agent panel.
  66    #[serde(default)]
  67    #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
  68    pub agent_buffer_font_size: Option<f32>,
  69    /// The name of the Zed theme to use.
  70    #[serde(default)]
  71    pub theme: Option<ThemeSelection>,
  72    /// The name of the icon theme to use.
  73    #[serde(default)]
  74    pub icon_theme: Option<IconThemeSelection>,
  75
  76    /// UNSTABLE: Expect many elements to be broken.
  77    ///
  78    // Controls the density of the UI.
  79    #[serde(rename = "unstable.ui_density", default)]
  80    pub ui_density: Option<UiDensity>,
  81
  82    /// How much to fade out unused code.
  83    #[serde(default)]
  84    #[schemars(range(min = 0.0, max = 0.9))]
  85    pub unnecessary_code_fade: Option<CodeFade>,
  86
  87    /// EXPERIMENTAL: Overrides for the current theme.
  88    ///
  89    /// These values will override the ones on the current theme specified in `theme`.
  90    #[serde(rename = "experimental.theme_overrides", default)]
  91    pub experimental_theme_overrides: Option<ThemeStyleContent>,
  92
  93    /// Overrides per theme
  94    ///
  95    /// These values will override the ones on the specified theme
  96    #[serde(default)]
  97    pub theme_overrides: HashMap<String, ThemeStyleContent>,
  98}
  99
 100#[derive(
 101    Clone,
 102    Copy,
 103    Debug,
 104    Serialize,
 105    Deserialize,
 106    JsonSchema,
 107    MergeFrom,
 108    PartialEq,
 109    PartialOrd,
 110    derive_more::FromStr,
 111)]
 112#[serde(transparent)]
 113pub struct CodeFade(#[serde(serialize_with = "serialize_f32_with_two_decimal_places")] pub f32);
 114
 115impl Display for CodeFade {
 116    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 117        write!(f, "{:.2}", self.0)
 118    }
 119}
 120
 121impl From<f32> for CodeFade {
 122    fn from(x: f32) -> Self {
 123        Self(x)
 124    }
 125}
 126
 127fn default_font_features() -> Option<FontFeatures> {
 128    Some(FontFeatures::default())
 129}
 130
 131fn default_font_fallbacks() -> Option<FontFallbacks> {
 132    Some(FontFallbacks::default())
 133}
 134
 135fn default_buffer_font_weight() -> Option<FontWeight> {
 136    Some(FontWeight::default())
 137}
 138
 139/// Represents the selection of a theme, which can be either static or dynamic.
 140#[derive(
 141    Clone,
 142    Debug,
 143    Serialize,
 144    Deserialize,
 145    JsonSchema,
 146    MergeFrom,
 147    PartialEq,
 148    Eq,
 149    strum::EnumDiscriminants,
 150)]
 151#[strum_discriminants(derive(strum::VariantArray, strum::VariantNames, strum::FromRepr))]
 152#[serde(untagged)]
 153pub enum ThemeSelection {
 154    /// A static theme selection, represented by a single theme name.
 155    Static(ThemeName),
 156    /// A dynamic theme selection, which can change based the [ThemeMode].
 157    Dynamic {
 158        /// The mode used to determine which theme to use.
 159        #[serde(default)]
 160        mode: ThemeMode,
 161        /// The theme to use for light mode.
 162        light: ThemeName,
 163        /// The theme to use for dark mode.
 164        dark: ThemeName,
 165    },
 166}
 167
 168/// Represents the selection of an icon theme, which can be either static or dynamic.
 169#[derive(
 170    Clone,
 171    Debug,
 172    Serialize,
 173    Deserialize,
 174    JsonSchema,
 175    MergeFrom,
 176    PartialEq,
 177    Eq,
 178    strum::EnumDiscriminants,
 179)]
 180#[strum_discriminants(derive(strum::VariantArray, strum::VariantNames, strum::FromRepr))]
 181#[serde(untagged)]
 182pub enum IconThemeSelection {
 183    /// A static icon theme selection, represented by a single icon theme name.
 184    Static(IconThemeName),
 185    /// A dynamic icon theme selection, which can change based on the [`ThemeMode`].
 186    Dynamic {
 187        /// The mode used to determine which theme to use.
 188        #[serde(default)]
 189        mode: ThemeMode,
 190        /// The icon theme to use for light mode.
 191        light: IconThemeName,
 192        /// The icon theme to use for dark mode.
 193        dark: IconThemeName,
 194    },
 195}
 196
 197// TODO: Rename ThemeMode -> ThemeAppearanceMode
 198/// The mode use to select a theme.
 199///
 200/// `Light` and `Dark` will select their respective themes.
 201///
 202/// `System` will select the theme based on the system's appearance.
 203#[derive(
 204    Debug,
 205    PartialEq,
 206    Eq,
 207    Clone,
 208    Copy,
 209    Default,
 210    Serialize,
 211    Deserialize,
 212    JsonSchema,
 213    MergeFrom,
 214    strum::VariantArray,
 215    strum::VariantNames,
 216)]
 217#[serde(rename_all = "snake_case")]
 218pub enum ThemeMode {
 219    /// Use the specified `light` theme.
 220    Light,
 221
 222    /// Use the specified `dark` theme.
 223    Dark,
 224
 225    /// Use the theme based on the system's appearance.
 226    #[default]
 227    System,
 228}
 229
 230/// Specifies the density of the UI.
 231/// Note: This setting is still experimental. See [this tracking issue](https://github.com/zed-industries/zed/issues/18078)
 232#[derive(
 233    Debug,
 234    Default,
 235    PartialEq,
 236    Eq,
 237    PartialOrd,
 238    Ord,
 239    Hash,
 240    Clone,
 241    Copy,
 242    Serialize,
 243    Deserialize,
 244    JsonSchema,
 245    MergeFrom,
 246)]
 247#[serde(rename_all = "snake_case")]
 248pub enum UiDensity {
 249    /// A denser UI with tighter spacing and smaller elements.
 250    #[serde(alias = "compact")]
 251    Compact,
 252    #[default]
 253    #[serde(alias = "default")]
 254    /// The default UI density.
 255    Default,
 256    #[serde(alias = "comfortable")]
 257    /// A looser UI with more spacing and larger elements.
 258    Comfortable,
 259}
 260
 261impl UiDensity {
 262    /// The spacing ratio of a given density.
 263    /// TODO: Standardize usage throughout the app or remove
 264    pub fn spacing_ratio(self) -> f32 {
 265        match self {
 266            UiDensity::Compact => 0.75,
 267            UiDensity::Default => 1.0,
 268            UiDensity::Comfortable => 1.25,
 269        }
 270    }
 271}
 272
 273/// Font family name.
 274#[skip_serializing_none]
 275#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
 276#[serde(transparent)]
 277pub struct FontFamilyName(pub Arc<str>);
 278
 279impl AsRef<str> for FontFamilyName {
 280    fn as_ref(&self) -> &str {
 281        &self.0
 282    }
 283}
 284
 285impl From<SharedString> for FontFamilyName {
 286    fn from(value: SharedString) -> Self {
 287        Self(Arc::from(value))
 288    }
 289}
 290
 291impl From<FontFamilyName> for SharedString {
 292    fn from(value: FontFamilyName) -> Self {
 293        SharedString::new(value.0)
 294    }
 295}
 296
 297impl From<String> for FontFamilyName {
 298    fn from(value: String) -> Self {
 299        Self(Arc::from(value))
 300    }
 301}
 302
 303impl From<FontFamilyName> for String {
 304    fn from(value: FontFamilyName) -> Self {
 305        value.0.to_string()
 306    }
 307}
 308
 309/// The buffer's line height.
 310#[derive(
 311    Clone,
 312    Copy,
 313    Debug,
 314    Serialize,
 315    Deserialize,
 316    PartialEq,
 317    JsonSchema,
 318    MergeFrom,
 319    Default,
 320    strum::EnumDiscriminants,
 321)]
 322#[strum_discriminants(derive(strum::VariantArray, strum::VariantNames, strum::FromRepr))]
 323#[serde(rename_all = "snake_case")]
 324pub enum BufferLineHeight {
 325    /// A less dense line height.
 326    #[default]
 327    Comfortable,
 328    /// The default line height.
 329    Standard,
 330    /// A custom line height, where 1.0 is the font's height. Must be at least 1.0.
 331    Custom(#[serde(deserialize_with = "deserialize_line_height")] f32),
 332}
 333
 334fn deserialize_line_height<'de, D>(deserializer: D) -> Result<f32, D::Error>
 335where
 336    D: serde::Deserializer<'de>,
 337{
 338    let value = f32::deserialize(deserializer)?;
 339    if value < 1.0 {
 340        return Err(serde::de::Error::custom(
 341            "buffer_line_height.custom must be at least 1.0",
 342        ));
 343    }
 344
 345    Ok(value)
 346}
 347
 348/// The content of a serialized theme.
 349#[skip_serializing_none]
 350#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 351#[serde(default)]
 352pub struct ThemeStyleContent {
 353    #[serde(default, rename = "background.appearance")]
 354    pub window_background_appearance: Option<WindowBackgroundContent>,
 355
 356    #[serde(default)]
 357    pub accents: Vec<AccentContent>,
 358
 359    #[serde(flatten, default)]
 360    pub colors: ThemeColorsContent,
 361
 362    #[serde(flatten, default)]
 363    pub status: StatusColorsContent,
 364
 365    #[serde(default)]
 366    pub players: Vec<PlayerColorContent>,
 367
 368    /// The styles for syntax nodes.
 369    #[serde(default)]
 370    pub syntax: IndexMap<String, HighlightStyleContent>,
 371}
 372
 373#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 374pub struct AccentContent(pub Option<String>);
 375
 376#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 377pub struct PlayerColorContent {
 378    pub cursor: Option<String>,
 379    pub background: Option<String>,
 380    pub selection: Option<String>,
 381}
 382
 383/// Theme name.
 384#[skip_serializing_none]
 385#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
 386#[serde(transparent)]
 387pub struct ThemeName(pub Arc<str>);
 388
 389/// Icon Theme Name
 390#[skip_serializing_none]
 391#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
 392#[serde(transparent)]
 393pub struct IconThemeName(pub Arc<str>);
 394
 395#[skip_serializing_none]
 396#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 397#[serde(default)]
 398pub struct ThemeColorsContent {
 399    /// Border color. Used for most borders, is usually a high contrast color.
 400    #[serde(rename = "border")]
 401    pub border: Option<String>,
 402
 403    /// Border color. Used for deemphasized borders, like a visual divider between two sections
 404    #[serde(rename = "border.variant")]
 405    pub border_variant: Option<String>,
 406
 407    /// Border color. Used for focused elements, like keyboard focused list item.
 408    #[serde(rename = "border.focused")]
 409    pub border_focused: Option<String>,
 410
 411    /// Border color. Used for selected elements, like an active search filter or selected checkbox.
 412    #[serde(rename = "border.selected")]
 413    pub border_selected: Option<String>,
 414
 415    /// Border color. Used for transparent borders. Used for placeholder borders when an element gains a border on state change.
 416    #[serde(rename = "border.transparent")]
 417    pub border_transparent: Option<String>,
 418
 419    /// Border color. Used for disabled elements, like a disabled input or button.
 420    #[serde(rename = "border.disabled")]
 421    pub border_disabled: Option<String>,
 422
 423    /// Background color. Used for elevated surfaces, like a context menu, popup, or dialog.
 424    #[serde(rename = "elevated_surface.background")]
 425    pub elevated_surface_background: Option<String>,
 426
 427    /// Background Color. Used for grounded surfaces like a panel or tab.
 428    #[serde(rename = "surface.background")]
 429    pub surface_background: Option<String>,
 430
 431    /// Background Color. Used for the app background and blank panels or windows.
 432    #[serde(rename = "background")]
 433    pub background: Option<String>,
 434
 435    /// Background Color. Used for the background of an element that should have a different background than the surface it's on.
 436    ///
 437    /// Elements might include: Buttons, Inputs, Checkboxes, Radio Buttons...
 438    ///
 439    /// For an element that should have the same background as the surface it's on, use `ghost_element_background`.
 440    #[serde(rename = "element.background")]
 441    pub element_background: Option<String>,
 442
 443    /// Background Color. Used for the hover state of an element that should have a different background than the surface it's on.
 444    ///
 445    /// Hover states are triggered by the mouse entering an element, or a finger touching an element on a touch screen.
 446    #[serde(rename = "element.hover")]
 447    pub element_hover: Option<String>,
 448
 449    /// Background Color. Used for the active state of an element that should have a different background than the surface it's on.
 450    ///
 451    /// Active states are triggered by the mouse button being pressed down on an element, or the Return button or other activator being pressed.
 452    #[serde(rename = "element.active")]
 453    pub element_active: Option<String>,
 454
 455    /// Background Color. Used for the selected state of an element that should have a different background than the surface it's on.
 456    ///
 457    /// Selected states are triggered by the element being selected (or "activated") by the user.
 458    ///
 459    /// This could include a selected checkbox, a toggleable button that is toggled on, etc.
 460    #[serde(rename = "element.selected")]
 461    pub element_selected: Option<String>,
 462
 463    /// Background Color. Used for the disabled state of an element that should have a different background than the surface it's on.
 464    ///
 465    /// Disabled states are shown when a user cannot interact with an element, like a disabled button or input.
 466    #[serde(rename = "element.disabled")]
 467    pub element_disabled: Option<String>,
 468
 469    /// Background Color. Used for the background of selections in a UI element.
 470    #[serde(rename = "element.selection_background")]
 471    pub element_selection_background: Option<String>,
 472
 473    /// Background Color. Used for the area that shows where a dragged element will be dropped.
 474    #[serde(rename = "drop_target.background")]
 475    pub drop_target_background: Option<String>,
 476
 477    /// Border Color. Used for the border that shows where a dragged element will be dropped.
 478    #[serde(rename = "drop_target.border")]
 479    pub drop_target_border: Option<String>,
 480
 481    /// Used for the background of a ghost element that should have the same background as the surface it's on.
 482    ///
 483    /// Elements might include: Buttons, Inputs, Checkboxes, Radio Buttons...
 484    ///
 485    /// For an element that should have a different background than the surface it's on, use `element_background`.
 486    #[serde(rename = "ghost_element.background")]
 487    pub ghost_element_background: Option<String>,
 488
 489    /// Background Color. Used for the hover state of a ghost element that should have the same background as the surface it's on.
 490    ///
 491    /// Hover states are triggered by the mouse entering an element, or a finger touching an element on a touch screen.
 492    #[serde(rename = "ghost_element.hover")]
 493    pub ghost_element_hover: Option<String>,
 494
 495    /// Background Color. Used for the active state of a ghost element that should have the same background as the surface it's on.
 496    ///
 497    /// Active states are triggered by the mouse button being pressed down on an element, or the Return button or other activator being pressed.
 498    #[serde(rename = "ghost_element.active")]
 499    pub ghost_element_active: Option<String>,
 500
 501    /// Background Color. Used for the selected state of a ghost element that should have the same background as the surface it's on.
 502    ///
 503    /// Selected states are triggered by the element being selected (or "activated") by the user.
 504    ///
 505    /// This could include a selected checkbox, a toggleable button that is toggled on, etc.
 506    #[serde(rename = "ghost_element.selected")]
 507    pub ghost_element_selected: Option<String>,
 508
 509    /// Background Color. Used for the disabled state of a ghost element that should have the same background as the surface it's on.
 510    ///
 511    /// Disabled states are shown when a user cannot interact with an element, like a disabled button or input.
 512    #[serde(rename = "ghost_element.disabled")]
 513    pub ghost_element_disabled: Option<String>,
 514
 515    /// Text Color. Default text color used for most text.
 516    #[serde(rename = "text")]
 517    pub text: Option<String>,
 518
 519    /// Text Color. Color of muted or deemphasized text. It is a subdued version of the standard text color.
 520    #[serde(rename = "text.muted")]
 521    pub text_muted: Option<String>,
 522
 523    /// Text Color. Color of the placeholder text typically shown in input fields to guide the user to enter valid data.
 524    #[serde(rename = "text.placeholder")]
 525    pub text_placeholder: Option<String>,
 526
 527    /// Text Color. Color used for text denoting disabled elements. Typically, the color is faded or grayed out to emphasize the disabled state.
 528    #[serde(rename = "text.disabled")]
 529    pub text_disabled: Option<String>,
 530
 531    /// Text Color. Color used for emphasis or highlighting certain text, like an active filter or a matched character in a search.
 532    #[serde(rename = "text.accent")]
 533    pub text_accent: Option<String>,
 534
 535    /// Fill Color. Used for the default fill color of an icon.
 536    #[serde(rename = "icon")]
 537    pub icon: Option<String>,
 538
 539    /// Fill Color. Used for the muted or deemphasized fill color of an icon.
 540    ///
 541    /// This might be used to show an icon in an inactive pane, or to deemphasize a series of icons to give them less visual weight.
 542    #[serde(rename = "icon.muted")]
 543    pub icon_muted: Option<String>,
 544
 545    /// Fill Color. Used for the disabled fill color of an icon.
 546    ///
 547    /// Disabled states are shown when a user cannot interact with an element, like a icon button.
 548    #[serde(rename = "icon.disabled")]
 549    pub icon_disabled: Option<String>,
 550
 551    /// Fill Color. Used for the placeholder fill color of an icon.
 552    ///
 553    /// This might be used to show an icon in an input that disappears when the user enters text.
 554    #[serde(rename = "icon.placeholder")]
 555    pub icon_placeholder: Option<String>,
 556
 557    /// Fill Color. Used for the accent fill color of an icon.
 558    ///
 559    /// This might be used to show when a toggleable icon button is selected.
 560    #[serde(rename = "icon.accent")]
 561    pub icon_accent: Option<String>,
 562
 563    /// Color used to accent some of the debuggers elements
 564    /// Only accent breakpoint & breakpoint related symbols right now
 565    #[serde(rename = "debugger.accent")]
 566    pub debugger_accent: Option<String>,
 567
 568    #[serde(rename = "status_bar.background")]
 569    pub status_bar_background: Option<String>,
 570
 571    #[serde(rename = "title_bar.background")]
 572    pub title_bar_background: Option<String>,
 573
 574    #[serde(rename = "title_bar.inactive_background")]
 575    pub title_bar_inactive_background: Option<String>,
 576
 577    #[serde(rename = "toolbar.background")]
 578    pub toolbar_background: Option<String>,
 579
 580    #[serde(rename = "tab_bar.background")]
 581    pub tab_bar_background: Option<String>,
 582
 583    #[serde(rename = "tab.inactive_background")]
 584    pub tab_inactive_background: Option<String>,
 585
 586    #[serde(rename = "tab.active_background")]
 587    pub tab_active_background: Option<String>,
 588
 589    #[serde(rename = "search.match_background")]
 590    pub search_match_background: Option<String>,
 591
 592    #[serde(rename = "panel.background")]
 593    pub panel_background: Option<String>,
 594
 595    #[serde(rename = "panel.focused_border")]
 596    pub panel_focused_border: Option<String>,
 597
 598    #[serde(rename = "panel.indent_guide")]
 599    pub panel_indent_guide: Option<String>,
 600
 601    #[serde(rename = "panel.indent_guide_hover")]
 602    pub panel_indent_guide_hover: Option<String>,
 603
 604    #[serde(rename = "panel.indent_guide_active")]
 605    pub panel_indent_guide_active: Option<String>,
 606
 607    #[serde(rename = "panel.overlay_background")]
 608    pub panel_overlay_background: Option<String>,
 609
 610    #[serde(rename = "panel.overlay_hover")]
 611    pub panel_overlay_hover: Option<String>,
 612
 613    #[serde(rename = "pane.focused_border")]
 614    pub pane_focused_border: Option<String>,
 615
 616    #[serde(rename = "pane_group.border")]
 617    pub pane_group_border: Option<String>,
 618
 619    /// The deprecated version of `scrollbar.thumb.background`.
 620    ///
 621    /// Don't use this field.
 622    #[serde(rename = "scrollbar_thumb.background", skip_serializing)]
 623    #[schemars(skip)]
 624    pub deprecated_scrollbar_thumb_background: Option<String>,
 625
 626    /// The color of the scrollbar thumb.
 627    #[serde(rename = "scrollbar.thumb.background")]
 628    pub scrollbar_thumb_background: Option<String>,
 629
 630    /// The color of the scrollbar thumb when hovered over.
 631    #[serde(rename = "scrollbar.thumb.hover_background")]
 632    pub scrollbar_thumb_hover_background: Option<String>,
 633
 634    /// The color of the scrollbar thumb whilst being actively dragged.
 635    #[serde(rename = "scrollbar.thumb.active_background")]
 636    pub scrollbar_thumb_active_background: Option<String>,
 637
 638    /// The border color of the scrollbar thumb.
 639    #[serde(rename = "scrollbar.thumb.border")]
 640    pub scrollbar_thumb_border: Option<String>,
 641
 642    /// The background color of the scrollbar track.
 643    #[serde(rename = "scrollbar.track.background")]
 644    pub scrollbar_track_background: Option<String>,
 645
 646    /// The border color of the scrollbar track.
 647    #[serde(rename = "scrollbar.track.border")]
 648    pub scrollbar_track_border: Option<String>,
 649
 650    /// The color of the minimap thumb.
 651    #[serde(rename = "minimap.thumb.background")]
 652    pub minimap_thumb_background: Option<String>,
 653
 654    /// The color of the minimap thumb when hovered over.
 655    #[serde(rename = "minimap.thumb.hover_background")]
 656    pub minimap_thumb_hover_background: Option<String>,
 657
 658    /// The color of the minimap thumb whilst being actively dragged.
 659    #[serde(rename = "minimap.thumb.active_background")]
 660    pub minimap_thumb_active_background: Option<String>,
 661
 662    /// The border color of the minimap thumb.
 663    #[serde(rename = "minimap.thumb.border")]
 664    pub minimap_thumb_border: Option<String>,
 665
 666    #[serde(rename = "editor.foreground")]
 667    pub editor_foreground: Option<String>,
 668
 669    #[serde(rename = "editor.background")]
 670    pub editor_background: Option<String>,
 671
 672    #[serde(rename = "editor.gutter.background")]
 673    pub editor_gutter_background: Option<String>,
 674
 675    #[serde(rename = "editor.subheader.background")]
 676    pub editor_subheader_background: Option<String>,
 677
 678    #[serde(rename = "editor.active_line.background")]
 679    pub editor_active_line_background: Option<String>,
 680
 681    #[serde(rename = "editor.highlighted_line.background")]
 682    pub editor_highlighted_line_background: Option<String>,
 683
 684    /// Background of active line of debugger
 685    #[serde(rename = "editor.debugger_active_line.background")]
 686    pub editor_debugger_active_line_background: Option<String>,
 687
 688    /// Text Color. Used for the text of the line number in the editor gutter.
 689    #[serde(rename = "editor.line_number")]
 690    pub editor_line_number: Option<String>,
 691
 692    /// Text Color. Used for the text of the line number in the editor gutter when the line is highlighted.
 693    #[serde(rename = "editor.active_line_number")]
 694    pub editor_active_line_number: Option<String>,
 695
 696    /// Text Color. Used for the text of the line number in the editor gutter when the line is hovered over.
 697    #[serde(rename = "editor.hover_line_number")]
 698    pub editor_hover_line_number: Option<String>,
 699
 700    /// Text Color. Used to mark invisible characters in the editor.
 701    ///
 702    /// Example: spaces, tabs, carriage returns, etc.
 703    #[serde(rename = "editor.invisible")]
 704    pub editor_invisible: Option<String>,
 705
 706    #[serde(rename = "editor.wrap_guide")]
 707    pub editor_wrap_guide: Option<String>,
 708
 709    #[serde(rename = "editor.active_wrap_guide")]
 710    pub editor_active_wrap_guide: Option<String>,
 711
 712    #[serde(rename = "editor.indent_guide")]
 713    pub editor_indent_guide: Option<String>,
 714
 715    #[serde(rename = "editor.indent_guide_active")]
 716    pub editor_indent_guide_active: Option<String>,
 717
 718    /// Read-access of a symbol, like reading a variable.
 719    ///
 720    /// A document highlight is a range inside a text document which deserves
 721    /// special attention. Usually a document highlight is visualized by changing
 722    /// the background color of its range.
 723    #[serde(rename = "editor.document_highlight.read_background")]
 724    pub editor_document_highlight_read_background: Option<String>,
 725
 726    /// Read-access of a symbol, like reading a variable.
 727    ///
 728    /// A document highlight is a range inside a text document which deserves
 729    /// special attention. Usually a document highlight is visualized by changing
 730    /// the background color of its range.
 731    #[serde(rename = "editor.document_highlight.write_background")]
 732    pub editor_document_highlight_write_background: Option<String>,
 733
 734    /// Highlighted brackets background color.
 735    ///
 736    /// Matching brackets in the cursor scope are highlighted with this background color.
 737    #[serde(rename = "editor.document_highlight.bracket_background")]
 738    pub editor_document_highlight_bracket_background: Option<String>,
 739
 740    /// Terminal background color.
 741    #[serde(rename = "terminal.background")]
 742    pub terminal_background: Option<String>,
 743
 744    /// Terminal foreground color.
 745    #[serde(rename = "terminal.foreground")]
 746    pub terminal_foreground: Option<String>,
 747
 748    /// Terminal ANSI background color.
 749    #[serde(rename = "terminal.ansi.background")]
 750    pub terminal_ansi_background: Option<String>,
 751
 752    /// Bright terminal foreground color.
 753    #[serde(rename = "terminal.bright_foreground")]
 754    pub terminal_bright_foreground: Option<String>,
 755
 756    /// Dim terminal foreground color.
 757    #[serde(rename = "terminal.dim_foreground")]
 758    pub terminal_dim_foreground: Option<String>,
 759
 760    /// Black ANSI terminal color.
 761    #[serde(rename = "terminal.ansi.black")]
 762    pub terminal_ansi_black: Option<String>,
 763
 764    /// Bright black ANSI terminal color.
 765    #[serde(rename = "terminal.ansi.bright_black")]
 766    pub terminal_ansi_bright_black: Option<String>,
 767
 768    /// Dim black ANSI terminal color.
 769    #[serde(rename = "terminal.ansi.dim_black")]
 770    pub terminal_ansi_dim_black: Option<String>,
 771
 772    /// Red ANSI terminal color.
 773    #[serde(rename = "terminal.ansi.red")]
 774    pub terminal_ansi_red: Option<String>,
 775
 776    /// Bright red ANSI terminal color.
 777    #[serde(rename = "terminal.ansi.bright_red")]
 778    pub terminal_ansi_bright_red: Option<String>,
 779
 780    /// Dim red ANSI terminal color.
 781    #[serde(rename = "terminal.ansi.dim_red")]
 782    pub terminal_ansi_dim_red: Option<String>,
 783
 784    /// Green ANSI terminal color.
 785    #[serde(rename = "terminal.ansi.green")]
 786    pub terminal_ansi_green: Option<String>,
 787
 788    /// Bright green ANSI terminal color.
 789    #[serde(rename = "terminal.ansi.bright_green")]
 790    pub terminal_ansi_bright_green: Option<String>,
 791
 792    /// Dim green ANSI terminal color.
 793    #[serde(rename = "terminal.ansi.dim_green")]
 794    pub terminal_ansi_dim_green: Option<String>,
 795
 796    /// Yellow ANSI terminal color.
 797    #[serde(rename = "terminal.ansi.yellow")]
 798    pub terminal_ansi_yellow: Option<String>,
 799
 800    /// Bright yellow ANSI terminal color.
 801    #[serde(rename = "terminal.ansi.bright_yellow")]
 802    pub terminal_ansi_bright_yellow: Option<String>,
 803
 804    /// Dim yellow ANSI terminal color.
 805    #[serde(rename = "terminal.ansi.dim_yellow")]
 806    pub terminal_ansi_dim_yellow: Option<String>,
 807
 808    /// Blue ANSI terminal color.
 809    #[serde(rename = "terminal.ansi.blue")]
 810    pub terminal_ansi_blue: Option<String>,
 811
 812    /// Bright blue ANSI terminal color.
 813    #[serde(rename = "terminal.ansi.bright_blue")]
 814    pub terminal_ansi_bright_blue: Option<String>,
 815
 816    /// Dim blue ANSI terminal color.
 817    #[serde(rename = "terminal.ansi.dim_blue")]
 818    pub terminal_ansi_dim_blue: Option<String>,
 819
 820    /// Magenta ANSI terminal color.
 821    #[serde(rename = "terminal.ansi.magenta")]
 822    pub terminal_ansi_magenta: Option<String>,
 823
 824    /// Bright magenta ANSI terminal color.
 825    #[serde(rename = "terminal.ansi.bright_magenta")]
 826    pub terminal_ansi_bright_magenta: Option<String>,
 827
 828    /// Dim magenta ANSI terminal color.
 829    #[serde(rename = "terminal.ansi.dim_magenta")]
 830    pub terminal_ansi_dim_magenta: Option<String>,
 831
 832    /// Cyan ANSI terminal color.
 833    #[serde(rename = "terminal.ansi.cyan")]
 834    pub terminal_ansi_cyan: Option<String>,
 835
 836    /// Bright cyan ANSI terminal color.
 837    #[serde(rename = "terminal.ansi.bright_cyan")]
 838    pub terminal_ansi_bright_cyan: Option<String>,
 839
 840    /// Dim cyan ANSI terminal color.
 841    #[serde(rename = "terminal.ansi.dim_cyan")]
 842    pub terminal_ansi_dim_cyan: Option<String>,
 843
 844    /// White ANSI terminal color.
 845    #[serde(rename = "terminal.ansi.white")]
 846    pub terminal_ansi_white: Option<String>,
 847
 848    /// Bright white ANSI terminal color.
 849    #[serde(rename = "terminal.ansi.bright_white")]
 850    pub terminal_ansi_bright_white: Option<String>,
 851
 852    /// Dim white ANSI terminal color.
 853    #[serde(rename = "terminal.ansi.dim_white")]
 854    pub terminal_ansi_dim_white: Option<String>,
 855
 856    #[serde(rename = "link_text.hover")]
 857    pub link_text_hover: Option<String>,
 858
 859    /// Added version control color.
 860    #[serde(rename = "version_control.added")]
 861    pub version_control_added: Option<String>,
 862
 863    /// Deleted version control color.
 864    #[serde(rename = "version_control.deleted")]
 865    pub version_control_deleted: Option<String>,
 866
 867    /// Modified version control color.
 868    #[serde(rename = "version_control.modified")]
 869    pub version_control_modified: Option<String>,
 870
 871    /// Renamed version control color.
 872    #[serde(rename = "version_control.renamed")]
 873    pub version_control_renamed: Option<String>,
 874
 875    /// Conflict version control color.
 876    #[serde(rename = "version_control.conflict")]
 877    pub version_control_conflict: Option<String>,
 878
 879    /// Ignored version control color.
 880    #[serde(rename = "version_control.ignored")]
 881    pub version_control_ignored: Option<String>,
 882
 883    /// Background color for row highlights of "ours" regions in merge conflicts.
 884    #[serde(rename = "version_control.conflict_marker.ours")]
 885    pub version_control_conflict_marker_ours: Option<String>,
 886
 887    /// Background color for row highlights of "theirs" regions in merge conflicts.
 888    #[serde(rename = "version_control.conflict_marker.theirs")]
 889    pub version_control_conflict_marker_theirs: Option<String>,
 890
 891    /// Deprecated in favor of `version_control_conflict_marker_ours`.
 892    #[deprecated]
 893    pub version_control_conflict_ours_background: Option<String>,
 894
 895    /// Deprecated in favor of `version_control_conflict_marker_theirs`.
 896    #[deprecated]
 897    pub version_control_conflict_theirs_background: Option<String>,
 898
 899    /// Background color for Vim Normal mode indicator.
 900    #[serde(rename = "vim.normal.background")]
 901    pub vim_normal_background: Option<String>,
 902    /// Background color for Vim Insert mode indicator.
 903    #[serde(rename = "vim.insert.background")]
 904    pub vim_insert_background: Option<String>,
 905    /// Background color for Vim Replace mode indicator.
 906    #[serde(rename = "vim.replace.background")]
 907    pub vim_replace_background: Option<String>,
 908    /// Background color for Vim Visual mode indicator.
 909    #[serde(rename = "vim.visual.background")]
 910    pub vim_visual_background: Option<String>,
 911    /// Background color for Vim Visual Line mode indicator.
 912    #[serde(rename = "vim.visual_line.background")]
 913    pub vim_visual_line_background: Option<String>,
 914    /// Background color for Vim Visual Block mode indicator.
 915    #[serde(rename = "vim.visual_block.background")]
 916    pub vim_visual_block_background: Option<String>,
 917    /// Background color for Vim Helix Normal mode indicator.
 918    #[serde(rename = "vim.helix_normal.background")]
 919    pub vim_helix_normal_background: Option<String>,
 920    /// Background color for Vim Helix Select mode indicator.
 921    #[serde(rename = "vim.helix_select.background")]
 922    pub vim_helix_select_background: Option<String>,
 923
 924    /// Text color for Vim mode indicator label.
 925    #[serde(rename = "vim.mode.text")]
 926    pub vim_mode_text: Option<String>,
 927}
 928
 929#[skip_serializing_none]
 930#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 931#[serde(default)]
 932pub struct HighlightStyleContent {
 933    pub color: Option<String>,
 934
 935    #[serde(deserialize_with = "treat_error_as_none")]
 936    pub background_color: Option<String>,
 937
 938    #[serde(deserialize_with = "treat_error_as_none")]
 939    pub font_style: Option<FontStyleContent>,
 940
 941    #[serde(deserialize_with = "treat_error_as_none")]
 942    pub font_weight: Option<FontWeightContent>,
 943}
 944
 945impl HighlightStyleContent {
 946    pub fn is_empty(&self) -> bool {
 947        self.color.is_none()
 948            && self.background_color.is_none()
 949            && self.font_style.is_none()
 950            && self.font_weight.is_none()
 951    }
 952}
 953
 954fn treat_error_as_none<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
 955where
 956    T: Deserialize<'de>,
 957    D: Deserializer<'de>,
 958{
 959    let value: Value = Deserialize::deserialize(deserializer)?;
 960    Ok(T::deserialize(value).ok())
 961}
 962
 963#[skip_serializing_none]
 964#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
 965#[serde(default)]
 966pub struct StatusColorsContent {
 967    /// Indicates some kind of conflict, like a file changed on disk while it was open, or
 968    /// merge conflicts in a Git repository.
 969    #[serde(rename = "conflict")]
 970    pub conflict: Option<String>,
 971
 972    #[serde(rename = "conflict.background")]
 973    pub conflict_background: Option<String>,
 974
 975    #[serde(rename = "conflict.border")]
 976    pub conflict_border: Option<String>,
 977
 978    /// Indicates something new, like a new file added to a Git repository.
 979    #[serde(rename = "created")]
 980    pub created: Option<String>,
 981
 982    #[serde(rename = "created.background")]
 983    pub created_background: Option<String>,
 984
 985    #[serde(rename = "created.border")]
 986    pub created_border: Option<String>,
 987
 988    /// Indicates that something no longer exists, like a deleted file.
 989    #[serde(rename = "deleted")]
 990    pub deleted: Option<String>,
 991
 992    #[serde(rename = "deleted.background")]
 993    pub deleted_background: Option<String>,
 994
 995    #[serde(rename = "deleted.border")]
 996    pub deleted_border: Option<String>,
 997
 998    /// Indicates a system error, a failed operation or a diagnostic error.
 999    #[serde(rename = "error")]
1000    pub error: Option<String>,
1001
1002    #[serde(rename = "error.background")]
1003    pub error_background: Option<String>,
1004
1005    #[serde(rename = "error.border")]
1006    pub error_border: Option<String>,
1007
1008    /// Represents a hidden status, such as a file being hidden in a file tree.
1009    #[serde(rename = "hidden")]
1010    pub hidden: Option<String>,
1011
1012    #[serde(rename = "hidden.background")]
1013    pub hidden_background: Option<String>,
1014
1015    #[serde(rename = "hidden.border")]
1016    pub hidden_border: Option<String>,
1017
1018    /// Indicates a hint or some kind of additional information.
1019    #[serde(rename = "hint")]
1020    pub hint: Option<String>,
1021
1022    #[serde(rename = "hint.background")]
1023    pub hint_background: Option<String>,
1024
1025    #[serde(rename = "hint.border")]
1026    pub hint_border: Option<String>,
1027
1028    /// Indicates that something is deliberately ignored, such as a file or operation ignored by Git.
1029    #[serde(rename = "ignored")]
1030    pub ignored: Option<String>,
1031
1032    #[serde(rename = "ignored.background")]
1033    pub ignored_background: Option<String>,
1034
1035    #[serde(rename = "ignored.border")]
1036    pub ignored_border: Option<String>,
1037
1038    /// Represents informational status updates or messages.
1039    #[serde(rename = "info")]
1040    pub info: Option<String>,
1041
1042    #[serde(rename = "info.background")]
1043    pub info_background: Option<String>,
1044
1045    #[serde(rename = "info.border")]
1046    pub info_border: Option<String>,
1047
1048    /// Indicates a changed or altered status, like a file that has been edited.
1049    #[serde(rename = "modified")]
1050    pub modified: Option<String>,
1051
1052    #[serde(rename = "modified.background")]
1053    pub modified_background: Option<String>,
1054
1055    #[serde(rename = "modified.border")]
1056    pub modified_border: Option<String>,
1057
1058    /// Indicates something that is predicted, like automatic code completion, or generated code.
1059    #[serde(rename = "predictive")]
1060    pub predictive: Option<String>,
1061
1062    #[serde(rename = "predictive.background")]
1063    pub predictive_background: Option<String>,
1064
1065    #[serde(rename = "predictive.border")]
1066    pub predictive_border: Option<String>,
1067
1068    /// Represents a renamed status, such as a file that has been renamed.
1069    #[serde(rename = "renamed")]
1070    pub renamed: Option<String>,
1071
1072    #[serde(rename = "renamed.background")]
1073    pub renamed_background: Option<String>,
1074
1075    #[serde(rename = "renamed.border")]
1076    pub renamed_border: Option<String>,
1077
1078    /// Indicates a successful operation or task completion.
1079    #[serde(rename = "success")]
1080    pub success: Option<String>,
1081
1082    #[serde(rename = "success.background")]
1083    pub success_background: Option<String>,
1084
1085    #[serde(rename = "success.border")]
1086    pub success_border: Option<String>,
1087
1088    /// Indicates some kind of unreachable status, like a block of code that can never be reached.
1089    #[serde(rename = "unreachable")]
1090    pub unreachable: Option<String>,
1091
1092    #[serde(rename = "unreachable.background")]
1093    pub unreachable_background: Option<String>,
1094
1095    #[serde(rename = "unreachable.border")]
1096    pub unreachable_border: Option<String>,
1097
1098    /// Represents a warning status, like an operation that is about to fail.
1099    #[serde(rename = "warning")]
1100    pub warning: Option<String>,
1101
1102    #[serde(rename = "warning.background")]
1103    pub warning_background: Option<String>,
1104
1105    #[serde(rename = "warning.border")]
1106    pub warning_border: Option<String>,
1107}
1108
1109/// The background appearance of the window.
1110#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, JsonSchema, MergeFrom)]
1111#[serde(rename_all = "snake_case")]
1112pub enum WindowBackgroundContent {
1113    Opaque,
1114    Transparent,
1115    Blurred,
1116}
1117
1118impl Into<gpui::WindowBackgroundAppearance> for WindowBackgroundContent {
1119    fn into(self) -> gpui::WindowBackgroundAppearance {
1120        match self {
1121            WindowBackgroundContent::Opaque => gpui::WindowBackgroundAppearance::Opaque,
1122            WindowBackgroundContent::Transparent => gpui::WindowBackgroundAppearance::Transparent,
1123            WindowBackgroundContent::Blurred => gpui::WindowBackgroundAppearance::Blurred,
1124        }
1125    }
1126}
1127
1128#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
1129#[serde(rename_all = "snake_case")]
1130pub enum FontStyleContent {
1131    Normal,
1132    Italic,
1133    Oblique,
1134}
1135
1136impl From<FontStyleContent> for FontStyle {
1137    fn from(value: FontStyleContent) -> Self {
1138        match value {
1139            FontStyleContent::Normal => FontStyle::Normal,
1140            FontStyleContent::Italic => FontStyle::Italic,
1141            FontStyleContent::Oblique => FontStyle::Oblique,
1142        }
1143    }
1144}
1145
1146#[derive(
1147    Debug, Clone, Copy, Serialize_repr, Deserialize_repr, JsonSchema_repr, PartialEq, MergeFrom,
1148)]
1149#[repr(u16)]
1150pub enum FontWeightContent {
1151    Thin = 100,
1152    ExtraLight = 200,
1153    Light = 300,
1154    Normal = 400,
1155    Medium = 500,
1156    Semibold = 600,
1157    Bold = 700,
1158    ExtraBold = 800,
1159    Black = 900,
1160}
1161
1162impl From<FontWeightContent> for FontWeight {
1163    fn from(value: FontWeightContent) -> Self {
1164        match value {
1165            FontWeightContent::Thin => FontWeight::THIN,
1166            FontWeightContent::ExtraLight => FontWeight::EXTRA_LIGHT,
1167            FontWeightContent::Light => FontWeight::LIGHT,
1168            FontWeightContent::Normal => FontWeight::NORMAL,
1169            FontWeightContent::Medium => FontWeight::MEDIUM,
1170            FontWeightContent::Semibold => FontWeight::SEMIBOLD,
1171            FontWeightContent::Bold => FontWeight::BOLD,
1172            FontWeightContent::ExtraBold => FontWeight::EXTRA_BOLD,
1173            FontWeightContent::Black => FontWeight::BLACK,
1174        }
1175    }
1176}
1177
1178#[cfg(test)]
1179mod tests {
1180    use super::*;
1181    use serde_json::json;
1182
1183    #[test]
1184    fn test_buffer_line_height_deserialize_valid() {
1185        assert_eq!(
1186            serde_json::from_value::<BufferLineHeight>(json!("comfortable")).unwrap(),
1187            BufferLineHeight::Comfortable
1188        );
1189        assert_eq!(
1190            serde_json::from_value::<BufferLineHeight>(json!("standard")).unwrap(),
1191            BufferLineHeight::Standard
1192        );
1193        assert_eq!(
1194            serde_json::from_value::<BufferLineHeight>(json!({"custom": 1.0})).unwrap(),
1195            BufferLineHeight::Custom(1.0)
1196        );
1197        assert_eq!(
1198            serde_json::from_value::<BufferLineHeight>(json!({"custom": 1.5})).unwrap(),
1199            BufferLineHeight::Custom(1.5)
1200        );
1201    }
1202
1203    #[test]
1204    fn test_buffer_line_height_deserialize_invalid() {
1205        assert!(
1206            serde_json::from_value::<BufferLineHeight>(json!({"custom": 0.99}))
1207                .err()
1208                .unwrap()
1209                .to_string()
1210                .contains("buffer_line_height.custom must be at least 1.0")
1211        );
1212        assert!(
1213            serde_json::from_value::<BufferLineHeight>(json!({"custom": 0.0}))
1214                .err()
1215                .unwrap()
1216                .to_string()
1217                .contains("buffer_line_height.custom must be at least 1.0")
1218        );
1219        assert!(
1220            serde_json::from_value::<BufferLineHeight>(json!({"custom": -1.0}))
1221                .err()
1222                .unwrap()
1223                .to_string()
1224                .contains("buffer_line_height.custom must be at least 1.0")
1225        );
1226    }
1227
1228    #[test]
1229    fn test_buffer_font_weight_schema_has_default() {
1230        use schemars::schema_for;
1231
1232        let schema = schema_for!(ThemeSettingsContent);
1233        let schema_value = serde_json::to_value(&schema).unwrap();
1234
1235        let properties = &schema_value["properties"];
1236        let buffer_font_weight = &properties["buffer_font_weight"];
1237
1238        assert!(
1239            buffer_font_weight.get("default").is_some(),
1240            "buffer_font_weight should have a default value in the schema"
1241        );
1242
1243        let default_value = &buffer_font_weight["default"];
1244        assert_eq!(
1245            default_value.as_f64(),
1246            Some(FontWeight::NORMAL.0 as f64),
1247            "buffer_font_weight default should be 400.0 (FontWeight::NORMAL)"
1248        );
1249
1250        let defs = &schema_value["$defs"];
1251        let font_weight_def = &defs["FontWeight"];
1252
1253        assert_eq!(
1254            font_weight_def["minimum"].as_f64(),
1255            Some(FontWeight::THIN.0 as f64),
1256            "FontWeight should have minimum of 100.0"
1257        );
1258        assert_eq!(
1259            font_weight_def["maximum"].as_f64(),
1260            Some(FontWeight::BLACK.0 as f64),
1261            "FontWeight should have maximum of 900.0"
1262        );
1263        assert_eq!(
1264            font_weight_def["default"].as_f64(),
1265            Some(FontWeight::NORMAL.0 as f64),
1266            "FontWeight should have default of 400.0"
1267        );
1268    }
1269}