Skip to content

c3 2.0.0

Choose a tag to compare

@danieledler danieledler released this 15 Oct 21:05
· 28 commits to main since this release
b82c90a

c3 2.0.0 adds palette() and hierarchy(), which pick colors in OKLCH, and removes the 1.x API.

New

  • palette(n, options): distinct categorical colors spread over hue, lightness and chroma. It stays deterministic, and asking for more colors never changes the earlier ones.
    • tone sets lightness and chroma. It takes a named tone (vivid, bright, strong (the default), deep, dark, soft, pastel or muted), colors to match, or your own ranges.
    • hue takes hues from the OKLCH hue circle ("Oklch", the default) or any d3 color scheme. offset sets where the first color sits, in degrees.
    • seeds starts the palette from colors you pick; method: "farthest" or "lookahead" then adds colors as far from them as possible.
    • end gives later colors their own lightness, so they don't compete with the first ones.
  • hierarchy(modules, options): colors for nested modules, such as an Infomap tree. Children vary around their parent's color, stay within the tone, and stay apart from their cousins.
  • Helpers: tones, inferTone, swatches, and oklab, oklch and distance for measuring how distinct colors are.
  • Docs: a new documentation app at https://mapequation.github.io/c3.

Breaking changes

1.x 2.0
colors(n, { scheme }) palette(n, { hue: scheme })
stops(), Node Removed from the public API
skewness Removed. Use an end zone (end) to set later colors apart

See the README for all options.