UNPKG

ixfx

Version:

A framework for programming interactivity

34 lines (31 loc) 1.07 kB
import { R as RandomSource } from './Types-CR0Pe5zY.js'; /** * Returns a full HSL colour string (eg `hsl(20,50%,75%)`) based on a index. * It's useful for generating perceptually different shades as the index increments. * * ``` * el.style.backgroundColor = goldenAgeColour(10); * ``` * * Saturation and lightness can be specified, as numeric ranges of 0-1. * * @param saturation Saturation (0-1), defaults to 0.5 * @param lightness Lightness (0-1), defaults to 0.75 * @param alpha Opacity (0-1), defaults to 1.0 * @returns HSL colour string eg `hsl(20,50%,75%)` */ declare const goldenAngleColour: (index: number, saturation?: number, lightness?: number, alpha?: number) => string; /** * Returns a random hue component (0..359) * ``` * // Generate hue * const h =randomHue(); // 0-359 * * // Generate hue and assign as part of a HSL string * el.style.backgroundColor = `hsl(${randomHue(), 50%, 75%})`; * ``` * @param rand * @returns */ declare const randomHue: (rand?: RandomSource) => number; export { goldenAngleColour as g, randomHue as r };