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

x/colors/src/color.ts

Color conversion and stuff in TypeScript
Go to Latest
import * as colors from "https://deno.land/x/colors@v2.0.0-rc.1/src/color.ts";

Functions

Get average of colors. Can be used for grayscale.

Calculate chroma

Convert RGB(A) to CMYK

Get contrast ratio

Convert RGB(A) to HCG

Convert RGB(A) to Hex

Convert RGB(A) to Hue, Saturation, Lightness

Convert RGB(A) to Hue, Saturation, Value

Calculate hue using chroma

Invert a color linearly

Bright colors darken, dark colors brighten.

CIE Lab color space

Get lightness of color.

Get linear rgb values

Calculate luminance

Get maximum of r, g, b

Get minimum of r, g, b

Mix with a different color. Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein http://sass-lang.com

Get perceived lightness

Get saturation

Get a shade of the color

Stringify the RGBA color

Get a tint of the color

CIE 1931 XYZ