kitchen-ui 0.0.2

Shared UI for GPUI apps (gpui-kit): design tokens, light and dark themes with a contrast-checked accent, widgets, a parameter editor, icon bundling and its test
Documentation
1
2
3
4
5
6
7
8
9
10
11
//! The colour swatch.

use gpui_kit::{Hsla, IntoElement, Styled as _, div, px};

use crate::theme::{self, color};

/// A colour chip `size` px square, outlined so a colour close to the panel's still shows its
/// edge. For 0–255 RGB use [`crate::theme::rgb8`].
pub fn swatch(c: impl Into<Hsla>, size: f32) -> impl IntoElement {
    div().flex_none().size(px(size)).rounded(px(theme::RADIUS_SM)).border_1().border_color(color::border()).bg(c.into())
}