pub struct ThemeBuilder { /* private fields */ }Expand description
Builder for custom themes.
Implementations§
Source§impl ThemeBuilder
impl ThemeBuilder
Sourcepub fn components(self, components: ComponentThemes) -> Self
pub fn components(self, components: ComponentThemes) -> Self
Component defaults and named recipes, resolved by renderers on every frame.
pub fn id(self, id: impl Into<SharedString>) -> Self
pub fn appearance(self, appearance: Appearance) -> Self
Sourcepub fn radius(self, radius: Pixels) -> Self
pub fn radius(self, radius: Pixels) -> Self
Sets --radius; --field-radius follows as radius * 1.5 unless it is
overridden afterwards with field_radius.
pub fn field_radius(self, radius: Pixels) -> Self
pub fn border_width(self, width: Pixels) -> Self
pub fn disabled_opacity(self, v: f32) -> Self
Sourcepub fn cursor_interactive(self, cursor: CursorStyle) -> Self
pub fn cursor_interactive(self, cursor: CursorStyle) -> Self
Sets the cursor every interactive control shows on hover. Defaults to
gpui::CursorStyle::PointingHand, v3’s cursor: pointer.
Sourcepub fn tabs_hover_opacity(self, v: f32) -> Self
pub fn tabs_hover_opacity(self, v: f32) -> Self
Sets the opacity a hovered Tabs item drops to. Finite values are
clamped to 0..=1; a non-finite value keeps the default 0.7.
Sourcepub fn tooltip_cooldown_ms(self, ms: u64) -> Self
pub fn tooltip_cooldown_ms(self, ms: u64) -> Self
Sets the warm window after the pointer leaves a tooltip during which
the next tip opens without its delay. A per-tooltip close delay
extends the window via max().
Sourcepub fn long_press_ms(self, ms: u64) -> Self
pub fn long_press_ms(self, ms: u64) -> Self
Sets how long a DropdownTrigger::LongPress waits before it opens.
Sourcepub fn hover_fade_ms(self, ms: u64) -> Self
pub fn hover_fade_ms(self, ms: u64) -> Self
Sets the background fade duration of anim::hover_fade. Zero resolves
immediately, like reduced motion.
Sourcepub fn tooltip_delay_ms(self, ms: u64) -> Self
pub fn tooltip_delay_ms(self, ms: u64) -> Self
--tooltip-delay: how long a hover waits before the tip opens.
Sourcepub fn tooltip_close_delay_ms(self, ms: u64) -> Self
pub fn tooltip_close_delay_ms(self, ms: u64) -> Self
--tooltip-close-delay: the per-tooltip close delay default.
pub fn background(self, c: Hsla) -> Self
pub fn foreground(self, c: Hsla) -> Self
pub fn muted(self, c: Hsla) -> Self
pub fn border(self, c: Hsla) -> Self
Sourcepub fn separator(self, c: Hsla) -> Self
pub fn separator(self, c: Hsla) -> Self
Sets --separator. Defaults to the same value as --border.
pub fn focus(self, c: Hsla) -> Self
pub fn link(self, c: Hsla) -> Self
pub fn backdrop(self, c: Hsla) -> Self
pub fn surface(self, background: Hsla, foreground: Hsla) -> Self
pub fn surface_levels(self, secondary: Hsla, tertiary: Hsla) -> Self
pub fn overlay(self, background: Hsla, foreground: Hsla) -> Self
pub fn segment(self, background: Hsla, foreground: Hsla) -> Self
Sourcepub fn role(self, name: &str, color: Hsla, foreground: Hsla) -> Self
pub fn role(self, name: &str, color: Hsla, foreground: Hsla) -> Self
Sets a role’s base value and foreground. Like overriding a CSS
variable, the role’s hover and soft mix weights carry over — only the
inputs change. --focus tracks --accent unless it is overridden
afterwards.
Sourcepub fn vibrant_palette(self, vibrant: bool) -> Self
pub fn vibrant_palette(self, vibrant: bool) -> Self
HeroUI’s opt-in [data-vibrant-palette="true"] block
(variables.css:317-330): the accent, success, warning and danger
*-soft-foreground mixes become 92% role over 8% page foreground in
both appearances, for more saturated soft text with less contrast.
--default-soft-foreground is not in that block and is left alone.
Off by default, like the attribute.
Sourcepub fn accent(self, color: Hsla) -> Self
pub fn accent(self, color: Hsla) -> Self
Sets --accent and --accent-foreground, deriving the foreground for
readability when it is not supplied.
Sourcepub fn role_hover(self, name: &str, hover: Hsla) -> Self
pub fn role_hover(self, name: &str, hover: Hsla) -> Self
Names a role’s *-hover shade outright, in place of the derived mix.
Upstream mixes a role toward its own foreground for hover, so a design
system whose hover moves the other way has no weight that expresses it.
Naming it here reaches every component that hovers the role, so
Variant::Primary is correct by construction rather than by converting
call sites to a named recipe carrying a
crate::ComponentColor::Literal. *-soft-hover is unaffected.
The name matches ThemeBuilder::role: default, success,
warning, danger, and anything else is accent.
Sourcepub fn accent_hover(self, hover: Hsla) -> Self
pub fn accent_hover(self, hover: Hsla) -> Self
ThemeBuilder::role_hover for accent, the role Variant::Primary
and the focus ring resolve.
pub fn field(self, background: Hsla, foreground: Hsla) -> Self
pub fn field_placeholder(self, c: Hsla) -> Self
pub fn field_border(self, c: Hsla) -> Self
pub fn build(self) -> Theme
Auto Trait Implementations§
impl Freeze for ThemeBuilder
impl RefUnwindSafe for ThemeBuilder
impl Send for ThemeBuilder
impl Sync for ThemeBuilder
impl Unpin for ThemeBuilder
impl UnsafeUnpin for ThemeBuilder
impl UnwindSafe for ThemeBuilder
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> 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