Expand description
Proc macros for gpui-ui-kit
Provides derive macros to reduce boilerplate in component theme definitions.
The primary macro is ComponentTheme which generates Default and From<&Theme>
implementations for theme structs, reducing repetitive boilerplate code.
§Quick Start
ⓘ
use gpui_ui_kit_macros::ComponentTheme;
#[derive(Debug, Clone, ComponentTheme)]
pub struct MyComponentTheme {
#[theme(default = 0x007acc, from = accent)]
pub primary_color: Rgba,
#[theme(default = 0xffffff, from = text_primary)]
pub text_color: Rgba,
}This generates:
impl Default for MyComponentThemeusing the hexdefaultvaluesimpl From<&Theme> for MyComponentThememapping from global theme fields
§Crate Features
This is a proc-macro crate. It must be used alongside the main gpui-ui-kit
crate which re-exports the macro as ComponentTheme.
Derive Macros§
- Component
Theme - Derive macro for component themes.