pub struct Theme {Show 21 fields
pub name: SharedString,
pub appearance: ThemeAppearance,
pub background: Hsla,
pub surface: Hsla,
pub inset: Hsla,
pub foreground: Hsla,
pub secondary: Hsla,
pub bright: Hsla,
pub accent: Hsla,
pub on_accent: Hsla,
pub selection: Hsla,
pub border: Hsla,
pub danger: Hsla,
pub warning: Hsla,
pub success: Hsla,
pub chart: [Hsla; 5],
pub font: SharedString,
pub mono_font: SharedString,
pub glass_tint: f32,
pub reduce_transparency: bool,
pub increased_contrast: bool,
}Expand description
Shared presentation for native adapters and the complete Kit facade.
Fields§
§name: SharedString§appearance: ThemeAppearance§background: Hsla§surface: Hsla§inset: Hsla§foreground: Hsla§secondary: Hsla§bright: Hsla§accent: Hsla§on_accent: Hsla§selection: Hsla§border: Hsla§danger: Hsla§warning: Hsla§success: Hsla§chart: [Hsla; 5]§font: SharedString§mono_font: SharedString§glass_tint: f32Material tint from clear (0) to fully tinted (1). Default: 0.65.
reduce_transparency: boolOpaque surfaces for Reduce transparency.
increased_contrast: boolStronger borders and separators for Increase contrast.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn follow_system(cx: &mut App)
pub fn follow_system(cx: &mut App)
Restore system appearance, preserving accent and material preferences.
Attach crate::observe_window once to each newly opened window.
pub fn is_following_system(cx: &App) -> bool
Source§impl Theme
impl Theme
pub fn light() -> Self
pub fn dark() -> Self
pub fn from_appearance(appearance: WindowAppearance) -> Self
Sourcepub fn system(cx: &App) -> Self
pub fn system(cx: &App) -> Self
Snapshot without changing whether the application follows the system.
pub fn is_dark(&self) -> bool
pub fn with_accent(self, accent: Hsla) -> Self
pub fn with_glass_tint(self, tint: f32) -> Self
pub fn with_reduce_transparency(self, reduce: bool) -> Self
pub fn with_increased_contrast(self, increase: bool) -> Self
pub fn normal_fill(&self) -> Hsla
pub fn hover_fill(&self) -> Hsla
pub fn selected_fill(&self) -> Hsla
pub fn pressed_fill(&self) -> Hsla
pub fn control_fill(&self) -> Hsla
pub fn control_border(&self) -> Hsla
pub fn focus_border(&self) -> Hsla
pub fn divider(&self) -> Hsla
Sourcepub fn glass_fill(&self) -> Hsla
pub fn glass_fill(&self) -> Hsla
Translucent fill over GPUI’s native blurred window backdrop. An approximation of the material; it does not implement Apple’s refraction shader.
pub fn glass_border(&self) -> Hsla
pub fn control_shadow(&self) -> Vec<BoxShadow>
pub fn focus_shadow(&self) -> Vec<BoxShadow>
pub fn popover_shadow(&self) -> Vec<BoxShadow>
pub fn input_style(&self) -> InputEditorStyle
pub fn tokens(&self) -> ColorTokens
Trait Implementations§
impl Global for Theme
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
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
Mutably borrows from an owned value. Read more
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReadGlobal for Twhere
T: Global,
impl<T> ReadGlobal for Twhere
T: Global,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().Source§impl<T> UpdateGlobal for Twhere
T: Global,
impl<T> UpdateGlobal for Twhere
T: Global,
Source§fn update_global<C, F, R>(cx: &mut C, update: F) -> R
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
Updates the global instance of the implementing type using the provided closure. Read more
Source§fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
Set the global instance of the implementing type.