pub struct Config { /* private fields */ }Expand description
Builds a Theme from your own colours, starting from the light or
dark defaults. Text on coloured surfaces, such as a primary button’s
label, is picked automatically with on.
use iced::color;
use iced_cube::theme::{Config, Tokens};
let theme = Config::light()
.name("Brand")
.primary(color!(0x4f46e5))
.accent(color!(0xeef2ff))
.build();
assert_eq!(Tokens::of(&theme).primary, color!(0x4f46e5));Implementations§
Source§impl Config
impl Config
Sourcepub fn name(self, name: impl Into<Cow<'static, str>>) -> Self
pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self
The theme’s name, as shown by iced’s theme pickers.
Sourcepub fn primary(self, colour: Color) -> Self
pub fn primary(self, colour: Color) -> Self
Filled buttons, checked controls, sliders and focus rings.
Sourcepub fn secondary(self, colour: Color) -> Self
pub fn secondary(self, colour: Color) -> Self
Secondary buttons and badges. Defaults to a shade of the background.
Sourcepub fn accent(self, colour: Color) -> Self
pub fn accent(self, colour: Color) -> Self
Hover and highlight surfaces, such as the selected option in a menu. Defaults to a shade of the background.
Sourcepub fn destructive(self, colour: Color) -> Self
pub fn destructive(self, colour: Color) -> Self
Destructive buttons, badges and errors.
pub fn success(self, colour: Color) -> Self
pub fn warning(self, colour: Color) -> Self
Sourcepub fn background(self, colour: Color) -> Self
pub fn background(self, colour: Color) -> Self
The window background. Whether the theme counts as dark follows from this colour.
Sourcepub fn foreground(self, colour: Color) -> Self
pub fn foreground(self, colour: Color) -> Self
Body text.
Sourcepub fn border(self, colour: Color) -> Self
pub fn border(self, colour: Color) -> Self
Borders of inputs, cards and separators. Defaults to a shade of the background.
Sourcepub fn extended(&self) -> Extended
pub fn extended(&self) -> Extended
The extended iced palette that Tokens::of reads. Secondary goes
in secondary.base, accent in secondary.weak and border in
background.strong.
Trait Implementations§
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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,
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>
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>
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)
&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)
&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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.