Skip to main content

Crate herogpui_core

Crate herogpui_core 

Source
Expand description

Core utilities and shared types for HeroGPUI.

Modules§

element_id
How a component mints the ElementIds it hands to gpui.

Structs§

NumberFormat
The formatOptions subset these components use.
SharedString
A shared string is an immutable string that can be cheaply cloned in GPUI tasks. Essentially an abstraction over an Arc<str> and &'static str, currently backed by a SmolStr.
UnknownColorError
The error Color’s FromStr returns for a name that is not one of the five v3 role tokens.

Enums§

Backdrop
Overlay scrim style — Modal, Drawer and AlertDialog.
Color
Semantic color roles — HeroUI v3.
CurrencySign
Intl.NumberFormatOptions["currencySign"].
FieldVariant
Form-control emphasis — primary carries the field shadow, secondary is the flat low-emphasis style for use inside a Surface.
NumberStyle
Intl.NumberFormatOptions["style"].
Orientation
Orientation for separators, toolbars, sliders and groups.
Placement
placement — where a floating panel sits relative to its trigger.
PlacementAlign
How a panel lines up along the trigger’s cross axis.
Prominence
Container prominence — Surface and Card. Separator uses the same ladder minus transparent.
SelectionBehavior
How a multi-select collection changes selection when an item is activated.
SelectionMode
How many items a collection lets the user select.
Size
The sm | md | lg scale used by most components.
SizeXl
The xs | sm | md | lg | xl scale used by Spinner, ColorSwatch and ColorSwatchPicker.
UnitDisplay
Intl.NumberFormatOptions["unitDisplay"].
Variant
Button emphasis variant — Button, and the vocabulary ButtonGroup inherits to its direct children (the pinned group context takes ButtonProps["variant"], every value on this enum).

Functions§

mix
Blends two colors in premultiplied sRGB space. Retained for gradients and other places where perceptual mixing is not wanted.
mix_oklab
CSS color-mix(in oklab, a (1-t), b t).
oklch
Builds a color from CSS oklch(l c h).
oklcha
oklch with an explicit alpha.
readable_color
Picks black or white for maximal contrast against background, matching readableColor from color2k as used by HeroUI.
soft_mix
CSS color-mix(in oklab, color p%, transparent) — the *-soft family.
with_alpha
Returns color with its alpha channel set to alpha.