pub struct ThemeDocument {Show 32 fields
pub id: String,
pub base: Appearance,
pub appearance: Option<Appearance>,
pub radius: Option<f32>,
pub field_radius: Option<f32>,
pub border_width: Option<f32>,
pub disabled_opacity: Option<f32>,
pub cursor_interactive: Option<CursorStyle>,
pub tabs_hover_opacity: Option<f32>,
pub tooltip_cooldown_ms: Option<u64>,
pub long_press_ms: Option<u64>,
pub hover_fade_ms: Option<u64>,
pub tooltip_delay_ms: Option<u64>,
pub tooltip_close_delay_ms: Option<u64>,
pub background: Option<String>,
pub foreground: Option<String>,
pub muted: Option<String>,
pub border: Option<String>,
pub separator: Option<String>,
pub focus: Option<String>,
pub link: Option<String>,
pub backdrop: Option<String>,
pub surface: Option<ColorPair>,
pub surface_levels: Option<SurfaceLevels>,
pub overlay: Option<ColorPair>,
pub segment: Option<ColorPair>,
pub accent: Option<String>,
pub roles: Option<Roles>,
pub field: Option<ColorPair>,
pub field_placeholder: Option<String>,
pub field_border: Option<String>,
pub vibrant_palette: Option<bool>,
}Expand description
A sparse override document for a Theme.
id and base are required. Every other field is optional and maps onto
one ThemeBuilder method of the same name (role is the map roles).
Fields§
§id: StringThe theme id, as passed to Theme::builder.
base: AppearanceWhich built-in theme the overrides extend: "light" or "dark".
appearance: Option<Appearance>Overrides ThemeBuilder::appearance.
radius: Option<f32>Overrides ThemeBuilder::radius., in pixels.
field_radius: Option<f32>Overrides ThemeBuilder::field_radius., in pixels.
border_width: Option<f32>Overrides ThemeBuilder::border_width., in pixels.
disabled_opacity: Option<f32>Overrides ThemeBuilder::disabled_opacity.
cursor_interactive: Option<CursorStyle>The hover cursor for interactive controls, by gpui’s CursorStyle
variant name ("PointingHand" is v3’s cursor: pointer, "Arrow"
the platform default).
tabs_hover_opacity: Option<f32>The opacity a hovered Tabs item drops to; clamped to 0..=1.
tooltip_cooldown_ms: Option<u64>The warm window after the pointer leaves a tooltip during which the next tip opens without its delay.
long_press_ms: Option<u64>How long a DropdownTrigger::LongPress waits before it opens.
hover_fade_ms: Option<u64>The background fade duration of anim::hover_fade.
tooltip_delay_ms: Option<u64>--tooltip-delay: how long a hover waits before the tip opens.
tooltip_close_delay_ms: Option<u64>--tooltip-close-delay: the per-tooltip close delay default.
background: Option<String>Overrides ThemeBuilder::background.; a color string (oklch(), oklcha() or hex).
foreground: Option<String>Overrides ThemeBuilder::foreground.; a color string (oklch(), oklcha() or hex).
muted: Option<String>Overrides ThemeBuilder::muted.; a color string (oklch(), oklcha() or hex).
border: Option<String>Overrides ThemeBuilder::border.; a color string (oklch(), oklcha() or hex).
separator: Option<String>Overrides ThemeBuilder::separator.; a color string (oklch(), oklcha() or hex).
focus: Option<String>Overrides ThemeBuilder::focus.; a color string (oklch(), oklcha() or hex).
link: Option<String>Overrides ThemeBuilder::link.; a color string (oklch(), oklcha() or hex).
backdrop: Option<String>Overrides ThemeBuilder::backdrop.; a color string (oklch(), oklcha() or hex).
surface: Option<ColorPair>Overrides ThemeBuilder::surface..
surface_levels: Option<SurfaceLevels>Overrides ThemeBuilder::surface_levels..
overlay: Option<ColorPair>Overrides ThemeBuilder::overlay..
segment: Option<ColorPair>Overrides ThemeBuilder::segment..
accent: Option<String>Shorthand for ThemeBuilder::accent: sets --accent and derives
the foreground. Conflicts with roles.accent.
roles: Option<Roles>Per-role overrides, applied through ThemeBuilder::role.
field: Option<ColorPair>Overrides ThemeBuilder::field..
field_placeholder: Option<String>Overrides ThemeBuilder::field_placeholder.; a color string.
field_border: Option<String>Overrides ThemeBuilder::field_border.; a color string.
vibrant_palette: Option<bool>HeroUI’s [data-vibrant-palette="true"]: reweights the accent,
success, warning and danger *-soft-foreground mixes to 92/8.
Implementations§
Source§impl ThemeDocument
impl ThemeDocument
Sourcepub fn from_json(json: &str) -> Result<Self, ThemeDocumentError>
pub fn from_json(json: &str) -> Result<Self, ThemeDocumentError>
Parse a JSON document.
Sourcepub fn theme_from_json(json: &str) -> Result<Theme, ThemeDocumentError>
pub fn theme_from_json(json: &str) -> Result<Theme, ThemeDocumentError>
Parse a JSON document and apply it through ThemeBuilder.
Sourcepub fn to_json(&self) -> Result<String, ThemeDocumentError>
pub fn to_json(&self) -> Result<String, ThemeDocumentError>
Serialize this sparse document. Derived tokens are not written.
Sourcepub fn to_theme(&self) -> Result<Theme, ThemeDocumentError>
pub fn to_theme(&self) -> Result<Theme, ThemeDocumentError>
Apply the overrides through ThemeBuilder.
Trait Implementations§
Source§impl Clone for ThemeDocument
impl Clone for ThemeDocument
Source§impl Debug for ThemeDocument
impl Debug for ThemeDocument
Source§impl<'de> Deserialize<'de> for ThemeDocument
impl<'de> Deserialize<'de> for ThemeDocument
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ThemeDocument
impl RefUnwindSafe for ThemeDocument
impl Send for ThemeDocument
impl Sync for ThemeDocument
impl Unpin for ThemeDocument
impl UnsafeUnpin for ThemeDocument
impl UnwindSafe for ThemeDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more