import { Color } from "https://deno.land/x/colors@v1.2.1/mod.ts";
General class for RGBA colors
Properties
Get the average of all colors
Can also be used instead of grayscale
using
const color = new Color(r, g, b, a);
const avg = color.average;
const grayscaleColor = new Color(avg, avg, avg, a);
readonly
grayscale: ColorConvert to grayscale using luminance
Get lightness of image. Can also be used instead of grayscale
using
const color = new Color(r, g, b, a);
const l = color.lightness * 255;
const grayscaleColor = new Color(l, l, l, a);
Methods
Mix with a different color. Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein http://sass-lang.com
toJSON(): ColorData
Get a detailed conversion of the color.
toString(): string
Static Methods
Redundant static method for conversion from sRGB color space
toHex(n: number): string