pub struct Palette {
pub bg: u32,
pub text: u32,
pub primary: u32,
pub accent: u32,
pub success: u32,
pub error: u32,
pub warning: u32,
}Expand description
Minimal color palette for generating a full Theme
Contains 7 seed colors that are used to derive all 52 theme colors. This provides a simple way to create custom themes while maintaining visual consistency.
§Example
ⓘ
use ccf_gpui_widgets::{Theme, Palette};
// Use preset palettes
let dark_theme = Theme::from_palette(Palette::dark());
let light_theme = Theme::from_palette(Palette::light());
// Customize brand colors
let custom = Theme::from_palette(
Palette::dark()
.with_primary(0xe94560)
.with_accent(0x0f3460)
);Fields§
§bg: u32Base background color
text: u32Primary text color
primary: u32Primary accent color (buttons, active states)
accent: u32Secondary accent color (focus rings, selections)
success: u32Success/positive status color
error: u32Error/negative status color
warning: u32Warning status color
Implementations§
Source§impl Palette
impl Palette
Sourcepub fn with_primary(self, color: u32) -> Self
pub fn with_primary(self, color: u32) -> Self
Set the primary accent color
Sourcepub fn with_accent(self, color: u32) -> Self
pub fn with_accent(self, color: u32) -> Self
Set the secondary accent color
Sourcepub fn with_success(self, color: u32) -> Self
pub fn with_success(self, color: u32) -> Self
Set the success color
Sourcepub fn with_error(self, color: u32) -> Self
pub fn with_error(self, color: u32) -> Self
Set the error color
Sourcepub fn with_warning(self, color: u32) -> Self
pub fn with_warning(self, color: u32) -> Self
Set the warning color
Trait Implementations§
impl Copy for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnsafeUnpin for Palette
impl UnwindSafe for Palette
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
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
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().