Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/color_hash/mod.ts>default

Generate color based on the given string (using HSL color space and SHA256).
Latest
class default
import { default } from "https://deno.land/x/color_hash@v2.0.1/mod.ts";

Constructors

new
default(options?: { lightness?: number | number[]; saturation?: number | number[]; hue?: number | { max: number; min: number; } | { max: number; min: number; }[]; hash?: string | ((str: string) => number); })

Properties

hash: (str: string) => number
hueRanges: { max: number; min: number; }[]
L: number[]
S: number[]

Methods

hex(str: string)

Returns the hash in hex

hsl(str: string): [number, number, number]

Returns the hash in [h, s, l]. Note that H ∈ [0, 360); S ∈ [0, 1]; L ∈ [0, 1];

rgb(str: string)

Returns the hash in [r, g, b]. Note that R, G, B ∈ [0, 255]