Skip to content

Colour

The Visual.Colour module contains a bunch of general purpose colour manipulation functions. There are also sub-modules for HSL, SRGB and OKLCH for doing things in one of those colour spaces.

  • Colour.getCssVariable - get a value of a CSS variable or use a fallback value
  • Colour.convert - convert some kind of colour representation to a structured colour in a particular colour space
  • Colour.convertToString - convert some kind of colour representation to a CSS string and colour space
// Sub module
import { Colour } from "@ixfx/visual.js"
// Eg: Colour.toHsl();
// Whole module
import * as Visual from "@ixfx/visual.js"
// Eg: Visual.Colour.toHsl();
// From bundle
import { Visual } from "@ixfx"
// Eg: Visual.Colour.toHsl();
// And within your HTML's <HEAD> </HEAD> block:
<script type="importmap">{ "imports": { "@ixfx":"/ixfx/index.js", "@ixfx/": "/ixfx/" } }</script>