Expand description
Small pieces both apps use: an accent picker, a titled section, a labelled row, a slider, a dropdown of fixed
options, a stepper and a dragged number, a colour swatch, a centred empty state, an icon
button. Plain data in, no store; colours from the current look (crate::theme::color).
Structs§
- Accent
Changed - What the picker reports: the accent picked (
None: the app’s own). - Accent
Picker - A row to choose the accent: “App” (the app’s palette), the suggested colours
(
Rgb::SUGGESTED) as swatches, and gpui-kit’s colour picker for any other colour (hex, hue, saturation, lightness). The current choice is ringed, not only coloured (WCAG 1.4.1). Each swatch is a 24 px target (designparsertouch-target). It emitsAccentChanged; the owner stores the value and applies it (theme::use_look(look.with_accent(…))). - Empty
State - Centred icon, title and a line of explanation, with actions under it (added as children).
- Menu
Select - A button showing the current option; pressing it lists the options, the current one checked. It fills its place, so a long option ends in “…” instead of being cut or pushing the panel wider.
- Section
- A titled block of a panel: a short caps title (with something at its right, if given), then
its rows (added as children),
theme::SMapart. Boxed (Section::boxed), the rows sit in a bordered box.
Constants§
- SCRUB_
PX - Pointer px per step of a dragged number.
Functions§
- icon_
button - A small ghost icon button with a tooltip (the tooltip names what it does, since the icon
alone may not). gpui-kit’s small size: about 24 px square at the default text size
(designparser
touch-target). - row
label controlon one line when both fit: the labeltheme::LABEL_Wwide, the control the rest (at leasttheme::CONTROL_MIN_W). In a narrow panel the control drops under its label, full width. Nothing is clipped (a cut label names nothing): a long label wraps, a long value in a control ends in “…”.- scrub_
label - A number that changes as it is dragged (Affinity, Blender): press it and move left or right;
every
SCRUB_PXpx is one step down or up. The pointer may leave it while dragging. The caller holds the value and formats it;id(owned, unique in the window) names the drag. - slider
- A horizontal slider over
min..=maxwith the value printed beside it (fmt). A click sets the value; a drag follows the pointer (even off the track) and ends on release, whenon_changegetstrue. It keeps no state: the caller holds the value, andid(owned, unique in the window) names the drag in progress. The track’s element id is{id}-track. - stepper
− value +: a number changed in steps, by its buttons or by dragging the number (seescrub_label). The caller holds the value and formats it. Element ids:{id}-minus,{id}-value,{id}-plus. The buttons are gpui-kit’s small size,theme::XSapart (designparsertouch-target: about 24 px each).- swatch
- A colour chip
sizepx square, outlined so a colour close to the panel’s still shows its edge. For 0–255 RGB usecrate::theme::rgb8.