Skip to main content

ThemeDocument

Struct ThemeDocument 

Source
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: String§base: Appearance

Which built-in theme the overrides extend: "light" or "dark".

§appearance: Option<Appearance>§radius: Option<f32>§field_radius: Option<f32>§border_width: Option<f32>§disabled_opacity: Option<f32>§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>§foreground: Option<String>§muted: Option<String>§border: Option<String>§separator: Option<String>§focus: Option<String>§link: Option<String>§backdrop: Option<String>§surface: Option<ColorPair>§surface_levels: Option<SurfaceLevels>§overlay: Option<ColorPair>§segment: Option<ColorPair>§accent: Option<String>

Shorthand for ThemeBuilder::accent: sets --accent and derives the foreground. Conflicts with roles.accent.

§roles: Option<Roles>§field: Option<ColorPair>§field_placeholder: Option<String>§field_border: Option<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

Source

pub fn from_json(json: &str) -> Result<Self, ThemeDocumentError>

Parse a JSON document.

Source

pub fn theme_from_json(json: &str) -> Result<Theme, ThemeDocumentError>

Parse a JSON document and apply it through ThemeBuilder.

Source

pub fn to_json(&self) -> Result<String, ThemeDocumentError>

Serialize this sparse document. Derived tokens are not written.

Source

pub fn to_theme(&self) -> Result<Theme, ThemeDocumentError>

Apply the overrides through ThemeBuilder.

Trait Implementations§

Source§

impl Clone for ThemeDocument

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ThemeDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ThemeDocument

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ThemeDocument

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more