@skchr/color
    Preparing search index...

    Function token

    • Parses any recognizable color to the specified kind.

      The kind option supports the following types as options (case-insensitive):

      • 'arr' - Parses the color token to an array of channel values with the colorspace as the first element if the omitMode parameter is set to false in the options object.

      • 'num' - Parses the color token to its numerical equivalent to a number between 0 and 16,777,215.

      The numberType can be used to specify which type of number to return if the kind option is set to 'num':

      • 'hex' - Hexadecimal number

      • 'bin' - Binary number

      • 'oct' - Octal number

      • 'expo' - Decimal exponential notation

      • 'str' - Parses the color token to its hexadecimal string equivalent.

      • 'obj' - Parses the color token to a plain color object in the mode specified by the targetMode parameter in the options object.t

      If the color token has an explicit alpha (specified by the alpha key in color objects and as the fourth and last number in a color array) the string will be 8 characters long instead of 6.

      Parameters

      • color: ColorToken = "cyan"

        The color token to parse or convert.

      • Optionaloptions: TokenOptions

        Options to customize the parsing and output behaviour.

      Returns ColorToken

      • The parsed or converted color token in the specified format.