Skip to main content

ThemeData

Struct ThemeData 

Source
pub struct ThemeData {
Show 28 fields pub background: Color, pub foreground: Color, pub primary: Color, pub accent: Color, pub surface: Color, pub error: Color, pub border: Color, pub divider: Color, pub hover: Color, pub disabled: Color, pub selection: Color, pub icon: Color, pub radius_sm: f32, pub radius_md: f32, pub radius_lg: f32, pub spacing: f32, pub text: TextTheme, pub button: ButtonStyle, pub scrollbar: ScrollbarStyle, pub input: InputStyle, pub tooltip: TooltipStyle, pub menu: MenuStyle, pub tab: TabStyle, pub nav: NavStyle, pub feedback: FeedbackStyle, pub dropdown: DropdownStyle, pub dialog: DialogStyle, pub list: ListStyle,
}
Expand description

主题色板 + 子主题。

所有 update_should_notify 走 PartialEq 派生自动比较。

风格基准:JetBrains IDEA New UI(idea_dark() / idea_light()), dark() / light() 为同名别名。通用令牌(border / divider / hover) 供全部组件共享,做到“一次改主题、全局换肤“。

Fields§

§background: Color§foreground: Color§primary: Color§accent: Color§surface: Color§error: Color§border: Color§divider: Color§hover: Color§disabled: Color§selection: Color§icon: Color§radius_sm: f32§radius_md: f32§radius_lg: f32§spacing: f32§text: TextTheme§button: ButtonStyle§scrollbar: ScrollbarStyle§input: InputStyle§tooltip: TooltipStyle§menu: MenuStyle§tab: TabStyle§nav: NavStyle§feedback: FeedbackStyle§dropdown: DropdownStyle§dialog: DialogStyle§list: ListStyle

Implementations§

Source§

impl ThemeData

Source

pub fn idea_dark() -> Self

JetBrains IDEA New UI — 深色(Darcula 系新 UI)。

Source

pub fn idea_light() -> Self

JetBrains IDEA New UI — 浅色。

Source

pub fn dark() -> Self

深色主题 — IDEA New UI 风格(idea_dark() 别名)。

Source

pub fn light() -> Self

浅色主题 — IDEA New UI 风格(idea_light() 别名)。

Trait Implementations§

Source§

impl Clone for ThemeData

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 ThemeData

Source§

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

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

impl Default for ThemeData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ThemeData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ThemeData

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.