bezel
A gpui component library, SwiftUI-lean: style flows through the environment, never through parameters.
https://github.com/user-attachments/assets/6b5f16d0-9f58-48d6-8398-09acb1afa402
use ;
theme.button
Install
[]
= "0.1"
An app also names the two crates the facade cannot cover — gpui because
actions! expands to literal gpui:: paths, and gpui_platform because the
facade re-exports gpui but not the platform. Both are our fork of gpui,
published under bezel-gpui*; the package key keeps the gpui:: paths the
macros and gpui's own docs expect:
= { = "bezel-gpui", = "0.3" }
= { = "bezel-gpui-platform", = "0.3", = ["font-kit"] }
Theme
Most apps want the shipped palette in their own hues. That is a Brand — one
hue for the greys, one for the accent, one base radius:
use ;
// before appearance::init
set_brand;
Lightness is not a knob, so a branded palette keeps the contrast ratios the shipped one was verified at. The gallery's Create page is this struct with sliders on it, and prints the call back.
For colors a hue rotation cannot reach, register a palette builder instead — it runs first, and a brand rotates whatever it returns:
use ;
set_palette;
Build an app
apps/hello is the smallest consumer — one window, a button, a toggle.
Every gpui type path goes through bezel::gpui, so a second gpui cannot
creep into the graph. The bootstrap, which is the part no snippet can skip:
use ;
use ;
use ui;
Hello is a struct implementing Render; its render reads the theme with
Theme::of(cx) and builds elements through the widgets traits. Run
cargo run -p hello and read apps/hello/src/main.rs for the rest.
Provenance
| What | From | License |
|---|---|---|
| Initial components | comet | MIT |
| Thinking orbs | gpui-thinking-orbs | MIT |
| Blob avatars | blobatar | MIT |
| Syntax highlighting | tree-sitter core and grammars | MIT |
| TypeScript/TSX queries | nvim-treesitter | Apache-2.0 |
| Icons | Solar Icons by 480 Design | CC BY 4.0 |
| Fonts | Geist and Geist Mono © Vercel Inc. | SIL OFL 1.1 |