Class ToggleHex

Convert a hexadecimal to an array of numbers or an array of numbers to a hexadecimal with the objective of doing mathematical operations with hexadecimal colors

Hierarchy

Constructors

Methods

Constructors

Methods

  • Convert a hex string to an array of numbers

    Example

    hexToInts("#5544ff") // [5,5,4,4,15,15]
    hexToInts("ccddff") // [12,12,13,13,15,15]

    Parameters

    • hexStrin: string[]

      Hex string

    Returns number[]

  • Convert an array of numbers to a hex string

    Example

    inToHex([15,15,10,10,9,9,00]) // "#ffaa9900"
    inToHex([5,5,4,4,15,15]) // #5544ff

    Parameters

    • numbers: number[]

      array of numbers from 0 to 15

    Returns string

Generated using TypeDoc