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

x/chalkpot_color/mod.ts>AdvancedColor

Color is a tool for creating RGB color by range and by HSL without leaving RGB space.
Go to Latest
class AdvancedColor
import { AdvancedColor } from "https://deno.land/x/chalkpot_color@1.1.0/mod.ts";

AdvancedColor is an advanced RGB color. Like regular Color, it mimics the HSL model.

Example

const darkGreen = new AdvancedColor(33.33, undefined, 25);
console.log(darkGreen.components); // [0, 127.8, 0]

const paleRed = new AdvancedColor(100, 70, 80);
console.log(paleRed.components); // [255, 173.3, 173.3]

Hue. Percentage value of the color wheel from 0 to 100:

  • Red: 0;
  • Green: 33.33;
  • Blue: 66.66;
  • Red: 100;

Saturation. Percentage value from 0 to 100:

  • Colorless (grey color): 0;
  • Hue color: 100;

Lightness. Percentage value from 0 to 100:

  • Black: 0;
  • Hue color: 50;
  • White: 100;

Constructors

new
AdvancedColor(
hue: number,
saturation?: number | undefined,
lightness?: number | undefined,
)

Properties

private
_rgbColor: Color
private
hueColor: Color
private
lightnessColor: Color
private
saturationColor: Color
readonly
blue: number
readonly
components: Rgb
readonly
green: number
readonly
hue: number
readonly
lightness: number
readonly
red: number
readonly
rgbColor: Color
readonly
saturation: number

Methods

private
addHueColor(): void
private
createLightnessColor(): void
private
createSaturationColor(): void