color

  • Version 5.0.0
  • Published
  • 26.3 kB
  • 2 dependencies
  • MIT license

Install

npm i color
yarn add color
pnpm add color

Overview

Color conversion and manipulation with CSS string support

Index

Variables

variable Color

const Color: ColorConstructor;

    Interfaces

    interface ColorInstance

    interface ColorInstance {}

      method a

      a: { (): number; (value: number): ColorInstance };

        method alpha

        alpha: { (): number; (value: number): ColorInstance };

          method ansi16

          ansi16: (...arguments_: number[]) => ColorInstance;

            method ansi256

            ansi256: (...arguments_: number[]) => ColorInstance;

              method apple

              apple: (...arguments_: number[]) => ColorInstance;

                method array

                array: () => number[];

                  method b

                  b: { (): number; (value: number): ColorInstance };

                    method black

                    black: { (): number; (value: number): ColorInstance };

                      method blacken

                      blacken: (ratio: number) => ColorInstance;

                        method blue

                        blue: { (): number; (value: number): ColorInstance };

                          method chroma

                          chroma: { (): number; (value: number): ColorInstance };

                            method cmyk

                            cmyk: (...arguments_: number[]) => ColorInstance;

                              method contrast

                              contrast: (color2: ColorInstance) => number;

                                method cyan

                                cyan: { (): number; (value: number): ColorInstance };

                                  method darken

                                  darken: (ratio: number) => ColorInstance;

                                    method desaturate

                                    desaturate: (ratio: number) => ColorInstance;

                                      method fade

                                      fade: (ratio: number) => ColorInstance;

                                        method gray

                                        gray: { (): number; (value: number): ColorInstance };

                                          method grayscale

                                          grayscale: () => ColorInstance;

                                            method green

                                            green: { (): number; (value: number): ColorInstance };

                                              method hcg

                                              hcg: (...arguments_: number[]) => ColorInstance;

                                                method hex

                                                hex: { (): string; <V extends string>(value: V): ColorInstance };

                                                  method hexa

                                                  hexa: { (): string; <V extends string>(value: V): ColorInstance };

                                                    method hsl

                                                    hsl: (...arguments_: number[]) => ColorInstance;

                                                      method hsv

                                                      hsv: (...arguments_: number[]) => ColorInstance;

                                                        method hue

                                                        hue: { (): number; (value: number): ColorInstance };

                                                          method hwb

                                                          hwb: (...arguments_: number[]) => ColorInstance;

                                                            method isDark

                                                            isDark: () => boolean;

                                                              method isLight

                                                              isLight: () => boolean;

                                                                method keyword

                                                                keyword: { (): string; <V extends string>(value: V): ColorInstance };

                                                                  method l

                                                                  l: { (): number; (value: number): ColorInstance };

                                                                    method lab

                                                                    lab: (...arguments_: number[]) => ColorInstance;

                                                                      method lch

                                                                      lch: (...arguments_: number[]) => ColorInstance;

                                                                        method level

                                                                        level: (color2: ColorInstance) => 'AAA' | 'AA' | '';

                                                                          method lighten

                                                                          lighten: (ratio: number) => ColorInstance;

                                                                            method lightness

                                                                            lightness: { (): number; (value: number): ColorInstance };

                                                                              method luminosity

                                                                              luminosity: () => number;

                                                                                method magenta

                                                                                magenta: { (): number; (value: number): ColorInstance };

                                                                                  method mix

                                                                                  mix: (mixinColor: ColorInstance, weight?: number) => ColorInstance;

                                                                                    method negate

                                                                                    negate: () => ColorInstance;

                                                                                      method object

                                                                                      object: () => ColorObject;

                                                                                        method opaquer

                                                                                        opaquer: (ratio: number) => ColorInstance;

                                                                                          method percentString

                                                                                          percentString: (places?: number) => string;

                                                                                            method red

                                                                                            red: { (): number; (value: number): ColorInstance };

                                                                                              method rgb

                                                                                              rgb: (...arguments_: number[]) => ColorInstance;

                                                                                                method rgbNumber

                                                                                                rgbNumber: () => number;

                                                                                                  method rotate

                                                                                                  rotate: (degrees: number) => ColorInstance;

                                                                                                    method round

                                                                                                    round: (places?: number) => ColorInstance;

                                                                                                      method saturate

                                                                                                      saturate: (ratio: number) => ColorInstance;

                                                                                                        method saturationl

                                                                                                        saturationl: { (): number; (value: number): ColorInstance };

                                                                                                          method saturationv

                                                                                                          saturationv: { (): number; (value: number): ColorInstance };

                                                                                                            method string

                                                                                                            string: (places?: number) => string;

                                                                                                              method toJSON

                                                                                                              toJSON: () => ColorJson;

                                                                                                                method toString

                                                                                                                toString: () => string;

                                                                                                                  method unitArray

                                                                                                                  unitArray: () => number[];

                                                                                                                    method unitObject

                                                                                                                    unitObject: () => {
                                                                                                                    r: number;
                                                                                                                    g: number;
                                                                                                                    b: number;
                                                                                                                    alpha?: number | undefined;
                                                                                                                    };

                                                                                                                      method value

                                                                                                                      value: { (): number; (value: number): ColorInstance };

                                                                                                                        method wblack

                                                                                                                        wblack: { (): number; (value: number): ColorInstance };

                                                                                                                          method white

                                                                                                                          white: { (): number; (value: number): ColorInstance };

                                                                                                                            method whiten

                                                                                                                            whiten: (ratio: number) => ColorInstance;

                                                                                                                              method x

                                                                                                                              x: { (): number; (value: number): ColorInstance };

                                                                                                                                method xyz

                                                                                                                                xyz: (...arguments_: number[]) => ColorInstance;

                                                                                                                                  method y

                                                                                                                                  y: { (): number; (value: number): ColorInstance };

                                                                                                                                    method yellow

                                                                                                                                    yellow: { (): number; (value: number): ColorInstance };

                                                                                                                                      method z

                                                                                                                                      z: { (): number; (value: number): ColorInstance };

                                                                                                                                        Type Aliases

                                                                                                                                        type ColorConstructor

                                                                                                                                        type ColorConstructor = {
                                                                                                                                        (object?: ColorLike, model?: keyof typeof convert): ColorInstance;
                                                                                                                                        new (object?: ColorLike, model?: keyof typeof convert): ColorInstance;
                                                                                                                                        rgb(...value: number[]): ColorInstance;
                                                                                                                                        rgb(color: ColorLike): ColorInstance;
                                                                                                                                        hsl(...value: number[]): ColorInstance;
                                                                                                                                        hsl(color: ColorLike): ColorInstance;
                                                                                                                                        hsv(...value: number[]): ColorInstance;
                                                                                                                                        hsv(color: ColorLike): ColorInstance;
                                                                                                                                        hwb(...value: number[]): ColorInstance;
                                                                                                                                        hwb(color: ColorLike): ColorInstance;
                                                                                                                                        cmyk(...value: number[]): ColorInstance;
                                                                                                                                        cmyk(color: ColorLike): ColorInstance;
                                                                                                                                        xyz(...value: number[]): ColorInstance;
                                                                                                                                        xyz(color: ColorLike): ColorInstance;
                                                                                                                                        lab(...value: number[]): ColorInstance;
                                                                                                                                        lab(color: ColorLike): ColorInstance;
                                                                                                                                        lch(...value: number[]): ColorInstance;
                                                                                                                                        lch(color: ColorLike): ColorInstance;
                                                                                                                                        ansi16(...value: number[]): ColorInstance;
                                                                                                                                        ansi16(color: ColorLike): ColorInstance;
                                                                                                                                        ansi256(...value: number[]): ColorInstance;
                                                                                                                                        ansi256(color: ColorLike): ColorInstance;
                                                                                                                                        hcg(...value: number[]): ColorInstance;
                                                                                                                                        hcg(color: ColorLike): ColorInstance;
                                                                                                                                        apple(...value: number[]): ColorInstance;
                                                                                                                                        apple(color: ColorLike): ColorInstance;
                                                                                                                                        };

                                                                                                                                          type ColorJson

                                                                                                                                          type ColorJson = { model: string; color: number[]; valpha: number };

                                                                                                                                            type ColorLike

                                                                                                                                            type ColorLike =
                                                                                                                                            | ColorInstance
                                                                                                                                            | string
                                                                                                                                            | ArrayLike<number>
                                                                                                                                            | number
                                                                                                                                            | Record<string, any>;

                                                                                                                                              type ColorObject

                                                                                                                                              type ColorObject = { alpha?: number | undefined } & Record<string, number>;

                                                                                                                                                Package Files (1)

                                                                                                                                                Dependencies (2)

                                                                                                                                                Dev Dependencies (3)

                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                No peer dependencies.

                                                                                                                                                Badge

                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/color.

                                                                                                                                                • Markdown
                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/color)
                                                                                                                                                • HTML
                                                                                                                                                  <a href="https://www.jsdocs.io/package/color"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>