Files
vectorcraft/crates/engine
dotCooCoo 47d6facb74 Part of #978: Show Hex Field in the Color Wheel panel takes hex with an alpha and CSS colors
Panel menu › Show Hex Field (ui.colorWheel {hexField}) adds a field under
the wheel or the box. It shows the color's six hex digits, and two more
while the opacity that Show Opacity sets is under 100 %. It takes a hex
color of 3, 4, 6 or 8 digits and a CSS rgb(), hsl() or oklch() color. A
typed color is applied in the same way as a wheel pick, in one undo step,
and an alpha sets that opacity, whether or not the opacity row shows.
Where the opacity row is gray (nothing selected, an object selected in a
symbol instance, or a fill or stroke row on type characters or missing),
only the color is applied. Text that gives the color and opacity already
there records no undo step, unless the color is a tint of a global
swatch. A click on the wheel that takes the focus from an edited field
applies the text, then the click. An opacity edit of a gradient stop or
point keeps the OKLCH values picked last for it, as it keeps the HSB.

- crates/color/src/css.rs reads the hex, rgb(), rgba(), hsl(), hsla()
  and oklch() syntax of CSS Color 4, the comma-separated legacy form of
  rgb() and hsl() included, and clamps values where CSS clamps them when
  it parses them. VectorCraft's own rules on top of that: the # of a hex
  color may be left out, none reads as 0, an hsl() channel outside the
  sRGB range is clipped, an oklch() color outside sRGB takes the largest
  chroma that fits, and text over 48 characters is refused.
- color.parse {text} answers {color, hex, opacity}; oklch() is an error
  while the working RGB space is not sRGB.
- The Color panel's hex field and the color parameters of other commands
  still refuse #rrggbbaa and #rgba.

Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md.
2026-11-16 00:44:14 -08:00
..