Constructors

Properties

a: number

alpha

b: number

blue

format: ColorFormats

the format used to create the tinycolor instance

g: number

green

gradientType?: string
isValid: boolean

the color was successfully parsed

originalInput: ColorInput

input passed into the constructer used to create the tinycolor instance

r: number

red

roundA: number

rounded alpha

Methods

  • Parameters

    • results: number = 6
    • slices: number = 30

    Returns TinyColor[]

  • Brighten the color a given amount, from 0 to 100.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Darken the color a given amount, from 0 to 100. Providing 100 will always return black.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • compare color vs current color

    Parameters

    Returns boolean

  • Returns the alpha value of a color, from 0-1.

    Returns number

  • Returns the perceived brightness of the color, from 0-255.

    Returns number

  • Returns the perceived luminance of a color, from 0-1.

    Returns number

  • Completely desaturates a color into greyscale. Same as calling desaturate(100)

    Returns TinyColor

  • Returns boolean

  • Returns boolean

  • Returns whether the color is monochrome.

    Returns boolean

  • Lighten the color a given amount. Providing 100 will always return white.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Mix the current color a given amount with another color, from 0 to 100. 0 means no mixing (return current color).

    Parameters

    Returns TinyColor

  • Parameters

    • results: number = 6

    Returns TinyColor[]

  • Compute how the color would appear on a background

    Parameters

    Returns TinyColor

  • Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...) monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...

    Parameters

    • n: number

    Returns TinyColor[]

  • Saturate the color a given amount, from 0 to 100.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Sets the alpha value on the current color.

    Parameters

    • Optional alpha: string | number

      The new alpha value. The accepted range is 0-1.

    Returns this

  • Mix the color with pure black, from 0 to 100. Providing 0 will do nothing, providing 100 will always return black.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. Values outside of this range will be wrapped into this range.

    Parameters

    • amount: number

    Returns TinyColor

  • Mix the color with pure white, from 0 to 100. Providing 0 will do nothing, providing 100 will always return white.

    Parameters

    • amount: number = 10

      valid between 1-100

    Returns TinyColor

  • Returns string

  • Returns the hex value of the color.

    Parameters

    • allow3Char: boolean = false

      will shorten hex value to 3 char if possible

    Returns string

  • Returns the hex 8 value of the color.

    Parameters

    • allow4Char: boolean = false

      will shorten hex value to 4 char if possible

    Returns string

  • Returns the hex 8 value of the color -with a # prefixed.

    Parameters

    • allow4Char: boolean = false

      will shorten hex value to 4 char if possible

    Returns string

  • Returns the shorter hex value of the color depends on its alpha -with a # prefixed.

    Parameters

    • allowShortChar: boolean = false

      will shorten hex value to 3 or 4 char if possible

    Returns string

  • Returns the hex value of the color -with a # prefixed.

    Parameters

    • allow3Char: boolean = false

      will shorten hex value to 3 char if possible

    Returns string

  • Returns the hsla values interpolated into a string with the following format: "hsla(xxx, xxx, xxx, xx)".

    Returns string

  • Returns the hsva values interpolated into a string with the following format: "hsva(xxx, xxx, xxx, xx)".

    Returns string

  • The 'real' name of the color -if there is one.

    Returns string | false

  • Returns number

  • Returns the object as a RGBA object.

    Returns RGBA

  • Returns the RGBA relative values interpolated into a string

    Returns string

  • Returns the RGBA values interpolated into a string with the following format: "RGBA(xxx, xxx, xxx, xx)".

    Returns string

  • String representation of the color.

    Type Parameters

    • T extends "name"

    Parameters

    • format: T

      The format to be used when displaying the string representation.

    Returns string | boolean

  • Type Parameters

    Parameters

    • Optional format: T

    Returns string