@thi.ng/color
Version:
Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets
63 lines • 2.5 kB
TypeScript
import type { Fn3, FnU3 } from "@thi.ng/api";
import type { MultiFn3O } from "@thi.ng/defmulti";
import type { IRandom } from "@thi.ng/random";
import type { Color, ReadonlyColor, TypedColor } from "./api.js";
export type AnalogFn = {
(out: Color | null, src: TypedColor<any>, delta: number, rnd?: IRandom): Color;
} & MultiFn3O<Color | null, TypedColor<any>, number, IRandom, Color>;
export declare const defAnalog: FnU3<Fn3<number, number, IRandom, number>, (out: Color | null, src: TypedColor<any>, delta: number, rnd?: IRandom) => Color>;
/**
* Returns a random analog color based on given `src` color and variance
* `delta`. Each channel will be randomized by +/- `delta`, optionally using
* provided
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
* PRNG.
*
* @remarks
* If `out` is null, the resulting color will be written back into `src`.
*
*/
export declare const analog: AnalogFn;
/**
* Similar to {@link analogRgb}. Returns an analog color based on given HSVA
* color, with each channel randomly varied by given channel-specific delta
* amounts (and optionally given
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
* PRNG).
*
* @remarks
* This function provides more user control than {@link analog}, but the latter
* is recommended for most use cases.
*
* By default (unless `deltaS`, `deltaV`, `deltaA` are provided) only the hue of
* the color will be modulated.
*
* @param out -
* @param src -
* @param deltaH -
* @param deltaS -
* @param deltaV -
* @param deltaA -
* @param rnd -
*/
export declare const analogHsv: (out: Color | null, src: ReadonlyColor, deltaH: number, deltaS?: number, deltaV?: number, deltaA?: number, rnd?: IRandom) => import("@thi.ng/vectors").Vec<number>;
/**
* Similar to {@link analogHsv}. Returns an analog color based on given RGBA
* color, with each channel randomly varied by given delta amounts (and
* optionally given
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
* PRNG).
*
* @remarks
* By default the green and blue channel variance will be the same as `deltaR`.
*
* @param out -
* @param src -
* @param deltaR -
* @param deltaG -
* @param deltaB -
* @param deltaA -
* @param rnd -
*/
export declare const analogRgb: (out: Color | null, src: ReadonlyColor, deltaR: number, deltaG?: number, deltaB?: number, deltaA?: number, rnd?: IRandom) => import("@thi.ng/vectors").Vec<number>;
//# sourceMappingURL=analog.d.ts.map