Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
Show 49 fields pub bg_primary: u32, pub bg_secondary: u32, pub bg_input: u32, pub bg_input_hover: u32, pub bg_hover: u32, pub bg_section_header: u32, pub bg_section_header_hover: u32, pub bg_white: u32, pub bg_light_hover: u32, pub text_primary: u32, pub text_label: u32, pub text_section_header: u32, pub text_value: u32, pub text_muted: u32, pub text_placeholder: u32, pub text_dimmed: u32, pub text_icon: u32, pub text_dark: u32, pub text_black: u32, pub border_default: u32, pub border_checkbox: u32, pub border_input: u32, pub border_menu: u32, pub border_focus: u32, pub border_focus_on_color: u32, pub border_error: u32, pub primary: u32, pub primary_hover: u32, pub primary_active: u32, pub accent: u32, pub success: u32, pub error: u32, pub warning: u32, pub error_text: u32, pub tooltip_bg: u32, pub tooltip_border: u32, pub tooltip_text: u32, pub selection: u32, pub disabled_bg: u32, pub disabled_text: u32, pub secondary_bg: u32, pub secondary_bg_hover: u32, pub secondary_bg_active: u32, pub secondary_border: u32, pub bg_tab_hover: u32, pub border_tab_active: u32, pub delete_bg: u32, pub delete_bg_hover: u32, pub bg_path_hover: u32,
}
Expand description

Theme configuration for widgets

All colors are stored as u32 hex values (0xRRGGBB format). Use with GPUI’s rgb() macro: rgb(theme.bg_primary)

Fields§

§bg_primary: u32

Main application background (darkest)

§bg_secondary: u32

Panel/section background (slightly lighter)

§bg_input: u32

Input field background

§bg_input_hover: u32

Input field background when hovered

§bg_hover: u32

Button/interactive element hover background

§bg_section_header: u32

Section header background

§bg_section_header_hover: u32

Section header hover background

§bg_white: u32

White background for light-themed elements

§bg_light_hover: u32

Light hover background

§text_primary: u32

Primary text color

§text_label: u32

Label text color

§text_section_header: u32

Section header text color

§text_value: u32

Value/content text color

§text_muted: u32

Muted/secondary text color

§text_placeholder: u32

Placeholder text color

§text_dimmed: u32

Dimmed/disabled text color

§text_icon: u32

Icon text color

§text_dark: u32

Dark text (on light backgrounds)

§text_black: u32

Black text

§border_default: u32

Standard border color

§border_checkbox: u32

Checkbox/radio button border

§border_input: u32

Input field border

§border_menu: u32

Menu/dropdown border

§border_focus: u32

Focus/active border

§border_focus_on_color: u32

Focus border for colored backgrounds (e.g., primary buttons) Should contrast with primary/accent colored elements

§border_error: u32

Error border

§primary: u32

Primary accent color (buttons, checkboxes)

§primary_hover: u32

Primary hover state

§primary_active: u32

Primary active/pressed state

§accent: u32

Accent color (focus rings, selections)

§success: u32

Success/positive color (green)

§error: u32

Error/negative color (red)

§warning: u32

Warning color (orange)

§error_text: u32

Validation error text

§tooltip_bg: u32

Tooltip background

§tooltip_border: u32

Tooltip border

§tooltip_text: u32

Tooltip text

§selection: u32§disabled_bg: u32

Disabled button background

§disabled_text: u32

Disabled button text

§secondary_bg: u32

Secondary button background

§secondary_bg_hover: u32

Secondary button hover background

§secondary_bg_active: u32

Secondary button active background

§secondary_border: u32

Secondary button border

§bg_tab_hover: u32

Tab hover background

§border_tab_active: u32

Active tab border

§delete_bg: u32

Delete button background

§delete_bg_hover: u32

Delete button hover background

§bg_path_hover: u32

Path display hover background

Implementations§

Source§

impl Theme

Source

pub fn dark() -> Self

Create a dark theme (default)

Source

pub fn light() -> Self

Create a light theme

Source

pub fn from_palette(palette: Palette) -> Self

Create a theme from a minimal color palette

This derives all 52 theme colors from just 7 seed colors, making it easy to create cohesive custom themes.

§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)
);
Source

pub fn with_accent(self, color: u32) -> Self

Set the accent color

Source

pub fn with_primary(self, color: u32) -> Self

Set the primary color

Source

pub fn with_primary_hover(self, color: u32) -> Self

Set the primary hover color

Source

pub fn with_border_focus(self, color: u32) -> Self

Set the focus border color

Source

pub fn with_border_focus_on_color(self, color: u32) -> Self

Set the focus border color for colored backgrounds

Source

pub fn with_success(self, color: u32) -> Self

Set the success color

Source

pub fn with_error(self, color: u32) -> Self

Set the error color

Source

pub fn with_warning(self, color: u32) -> Self

Set the warning color

Source

pub fn with_bg_primary(self, color: u32) -> Self

Set the primary background color

Source

pub fn with_bg_input(self, color: u32) -> Self

Set the input background color

Source

pub fn with_text_primary(self, color: u32) -> Self

Set the primary text color

Source

pub fn with_bg_secondary(self, color: u32) -> Self

Set the secondary background color

Source

pub fn with_bg_input_hover(self, color: u32) -> Self

Set the input hover background color

Source

pub fn with_bg_hover(self, color: u32) -> Self

Set the hover background color

Source

pub fn with_bg_section_header(self, color: u32) -> Self

Set the section header background color

Source

pub fn with_bg_section_header_hover(self, color: u32) -> Self

Set the section header hover background color

Source

pub fn with_bg_white(self, color: u32) -> Self

Set the white background color

Source

pub fn with_bg_light_hover(self, color: u32) -> Self

Set the light hover background color

Source

pub fn with_text_label(self, color: u32) -> Self

Set the label text color

Source

pub fn with_text_section_header(self, color: u32) -> Self

Set the section header text color

Source

pub fn with_text_value(self, color: u32) -> Self

Set the value text color

Source

pub fn with_text_muted(self, color: u32) -> Self

Set the muted text color

Source

pub fn with_text_placeholder(self, color: u32) -> Self

Set the placeholder text color

Source

pub fn with_text_dimmed(self, color: u32) -> Self

Set the dimmed text color

Source

pub fn with_text_icon(self, color: u32) -> Self

Set the icon text color

Source

pub fn with_text_dark(self, color: u32) -> Self

Set the dark text color

Source

pub fn with_text_black(self, color: u32) -> Self

Set the black text color

Source

pub fn with_border_default(self, color: u32) -> Self

Set the default border color

Source

pub fn with_border_checkbox(self, color: u32) -> Self

Set the checkbox border color

Source

pub fn with_border_input(self, color: u32) -> Self

Set the input border color

Source

pub fn with_border_menu(self, color: u32) -> Self

Set the menu border color

Source

pub fn with_border_error(self, color: u32) -> Self

Set the error border color

Source

pub fn with_primary_active(self, color: u32) -> Self

Set the primary active color

Source

pub fn with_error_text(self, color: u32) -> Self

Set the error text color

Source

pub fn with_tooltip_bg(self, color: u32) -> Self

Set the tooltip background color

Source

pub fn with_tooltip_border(self, color: u32) -> Self

Set the tooltip border color

Source

pub fn with_tooltip_text(self, color: u32) -> Self

Set the tooltip text color

Source

pub fn with_selection(self, color: u32) -> Self

Set the selection highlight color

Source

pub fn with_disabled_bg(self, color: u32) -> Self

Set the disabled button background color

Source

pub fn with_disabled_text(self, color: u32) -> Self

Set the disabled button text color

Source

pub fn with_secondary_bg(self, color: u32) -> Self

Set the secondary button background color

Source

pub fn with_secondary_bg_hover(self, color: u32) -> Self

Set the secondary button hover background color

Source

pub fn with_secondary_bg_active(self, color: u32) -> Self

Set the secondary button active background color

Source

pub fn with_secondary_border(self, color: u32) -> Self

Set the secondary button border color

Source

pub fn with_bg_tab_hover(self, color: u32) -> Self

Set the tab hover background color

Source

pub fn with_border_tab_active(self, color: u32) -> Self

Set the active tab border color

Source

pub fn with_delete_bg(self, color: u32) -> Self

Set the delete button background color

Source

pub fn with_delete_bg_hover(self, color: u32) -> Self

Set the delete button hover background color

Source

pub fn with_bg_path_hover(self, color: u32) -> Self

Set the path display hover background color

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

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

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

impl Default for Theme

Source§

fn default() -> Self

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

impl Copy for Theme

Source§

impl Global 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> 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> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ReadGlobal for T
where T: Global,

Source§

fn global(cx: &App) -> &T

Returns the global instance of the implementing type. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

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§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> UpdateGlobal for T
where T: Global,

Source§

fn update_global<C, F, R>(cx: &mut C, update: F) -> R
where C: BorrowAppContext, F: FnOnce(&mut T, &mut C) -> 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)

Set the global instance of the implementing type.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more