pub struct ThemeAppearance {
pub id: Option<String>,
pub light: ColorPalette,
pub dark: ColorPalette,
pub favicon: Option<FaviconAsset>,
pub typography: Option<TypographySettings>,
}Expand description
Resolved workspace appearance: theme colors, typography, and favicon.
This is the top-level appearance type supplied to the renderer.
Fields§
§id: Option<String>Theme identifier (e.g. “default”, “sepia”, “nord”).
light: ColorPaletteLight mode color palette.
dark: ColorPaletteDark mode color palette.
favicon: Option<FaviconAsset>Optional favicon. Not serialized (binary data).
typography: Option<TypographySettings>Typography settings (font, size, line-height, content width).
Implementations§
Source§impl ThemeAppearance
impl ThemeAppearance
Sourcepub fn to_css_overrides(&self) -> String
pub fn to_css_overrides(&self) -> String
Generate a CSS block that overrides the default :root and dark-mode
variables with theme colors and typography. Returns empty string if
nothing is set.
Sourcepub fn from_app_palette(
light: &HashMap<String, String>,
dark: &HashMap<String, String>,
) -> Self
pub fn from_app_palette( light: &HashMap<String, String>, dark: &HashMap<String, String>, ) -> Self
Create from an app ThemeDefinition’s color palettes.
Maps the app’s semantic color keys to CSS variables:
- background -> bg
- foreground -> text
- muted-foreground -> text-muted
- primary -> accent
- ring -> accent-hover
- border -> border
- secondary -> code-bg
- card -> surface-bg
- sidebar-border -> surface-border
Sourcepub fn generate_favicon_svg(&self) -> FaviconAsset
pub fn generate_favicon_svg(&self) -> FaviconAsset
Generate a fallback SVG favicon from the theme’s accent color.
Sourcepub fn favicon_or_default(&self) -> FaviconAsset
pub fn favicon_or_default(&self) -> FaviconAsset
Return the favicon if set, otherwise generate one from the accent color.
Trait Implementations§
Source§impl Clone for ThemeAppearance
impl Clone for ThemeAppearance
Source§fn clone(&self) -> ThemeAppearance
fn clone(&self) -> ThemeAppearance
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemeAppearance
impl Debug for ThemeAppearance
Source§impl Default for ThemeAppearance
impl Default for ThemeAppearance
Source§fn default() -> ThemeAppearance
fn default() -> ThemeAppearance
Returns the “default value” for a type. Read more
Source§impl FromValue for ThemeAppearance
impl FromValue for ThemeAppearance
Auto Trait Implementations§
impl Freeze for ThemeAppearance
impl RefUnwindSafe for ThemeAppearance
impl Send for ThemeAppearance
impl Sync for ThemeAppearance
impl Unpin for ThemeAppearance
impl UnsafeUnpin for ThemeAppearance
impl UnwindSafe for ThemeAppearance
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