@fimbul-works/vec-color
Version:
A comprehensive, type-safe color manipulation library for TypeScript that provides a wide range of color space conversions, blending operations, and accessibility utilities.
44 lines (43 loc) • 1.21 kB
TypeScript
import { Vec3 } from "@fimbul-works/vec";
/**
* Generates colors using cosine-based gradient
* @param t - Interpolation parameter (0 to 1)
* @param a - Vec3 center of oscillation
* @param b - Vec3 amplitude
* @param c - Vec3 frequency
* @param d - Vec3 phase
* @returns Vec3 containing the generated color
* @see https://iquilezles.org/articles/palettes/
*/
export declare function cosineGradient(t: number, a: Vec3, b: Vec3, c: Vec3, d: Vec3): Vec3;
export type CosineGradientPreset = {
a: Vec3;
b: Vec3;
c: Vec3;
d: Vec3;
};
/**
* Generates a palette using cosine gradient
* @param steps - Number of colors to generate
* @param preset - Preset parameters for the cosine gradient
* @returns Array of Vec3 colors
*/
export declare function generateCosinePalette(steps: number, preset: CosineGradientPreset): Vec3[];
export declare const COSINE_PRESET_RAINBOW: {
readonly a: Vec3;
readonly b: Vec3;
readonly c: Vec3;
readonly d: Vec3;
};
export declare const COSINE_PRESET_FIRE: {
readonly a: Vec3;
readonly b: Vec3;
readonly c: Vec3;
readonly d: Vec3;
};
export declare const COSINE_PRESET_ICE: {
a: Vec3;
b: Vec3;
c: Vec3;
d: Vec3;
};