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; and the text views: code (CodeView), diffs (DiffView) and light markdown
(TextView). 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(…))). - Code
Changed - What an editable
CodeViewreports when the user changes the text: the whole text. - Code
View - Code in a monospace editor: line numbers in a gutter, syntax highlighting (Rust, Python, JSON),
the current line highlighted, selection and copy (read-only too). Errors (
CodeView::errors, 1-based line numbers as compilers report them) get a red mark in the gutter and a red underline on their line, their message on hover, and are listed under the code: each entry moves the cursor to its line. - Diff
View - A git-style diff: added lines on a green tint, removed lines on a red one (the shared
success / danger colours, contrast-checked in both themes), old and new line numbers, a header
per hunk, and the unchanged runs between hunks folded to one line (“⋯ 12 unchanged lines”,
a click shows them). Each hunk keeps
CONTEXTunchanged lines around its changes. - Empty
State - Centred icon, title and a line of explanation, with actions under it (added as children).
- Hunk
Decision - What the reviewer decided for a hunk (
DiffView::reviewable). - 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. - Text
View - Wrapped, selectable text with light markdown: headings, emphasis,
codespans, bullet and numbered lists, links, and fenced code highlighted with the same grammars and colours ascrate::widgets::CodeView(```rust,```python,```json). As tall as its text.
Enums§
- Code
Language - The languages a
CodeViewhighlights.
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.