v0.1.0-next

v0.1.0 — prerelease

Unreleased

This version is a draft tracked on main and not yet tagged. The API is expected to change before the release.

The first draft of the color and theming library: an HSL color model, the common manipulation primitives and a set of color schemes.

Added

Colors

  • Color — an HSL color built on Degree and Fraction, which wrap and clamp their values on construction.
  • ColorLike — a union of Color, Int (hex) and Array (RGB or HSL), with from to normalize any of them into a Color.
  • Constructors hsl, rgb and hex, plus the constants white and black.
  • Manipulation functions complement, tint, shade, tone and mix.
  • Theme — five schemes (accent, highlight, surface, border, text) paired with four status colors (warning, error, info, success).
  • retroDark — a built-in dark theme with neon accents.

See Colors for the full reference.

Schemes

  • Scheme — the attribute behind every color scheme, mapping an index to a color, and SchemeLike with schemeFrom to normalize colors and arrays into schemes.
  • CustomScheme and ConstantScheme for user-supplied generators and fixed, wrapping color lists.
  • Color wheel schemes Complementary, Analogous, Triadic, Tetradic, GoldenSpiral and Rainbow.
  • Single base schemes Monochromatic, Shade, Tint, Tone and Mix.
  • prepend to put a fixed color in front of an existing scheme.

See Schemes for the full reference.

Maths

  • Degree — a numeric wrapper that wraps values around at 360.
  • Fraction — a numeric wrapper that clamps values to 0.0 … 1.0.

See Maths for the full reference.

Known issues

  • hex is unimplemented and panics. Everything derived from it — white, black and retroDark — panics as well; use rgb or hsl in the meantime.
  • Scheme fields are declared as Color2, a type that does not exist in colors.
  • tone declares a Tone return type but returns a Color.