Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils/converter

Index

References

RGBHexOptions

Re-exports RGBHexOptions

defaultRGB

Re-exports defaultRGB

enforceHSL

Re-exports enforceHSL

enforceHSV

Re-exports enforceHSV

enforceHex

Re-exports enforceHex

enforceRGB

Re-exports enforceRGB

hexToRgb

Re-exports hexToRgb

hslToHsl

Re-exports hslToHsl

hslToRgb

Re-exports hslToRgb

hsvToHsv

Re-exports hsvToHsv

hsvToRgb

Re-exports hsvToRgb

namedToRgb

Re-exports namedToRgb

rgbToHex

Re-exports rgbToHex

rgbToHsl

Re-exports rgbToHsl

rgbToHsv

Re-exports rgbToHsv

rgbToNamed

Re-exports rgbToNamed

rgbToRgb

Re-exports rgbToRgb

roundedHSL

Re-exports roundedHSL

roundedHSV

Re-exports roundedHSV

roundedRGB

Re-exports roundedRGB

toDecimal

Re-exports toDecimal

toNumber

Re-exports toNumber

toPercentage

Re-exports toPercentage

toType

Re-exports toType

Type aliases

Condition

Condition: Record<string, Rule>

Input

LoopFn

LoopFn: (n: number) => number

Type declaration

    • (n: number): number
    • Parameters

      • n: number

      Returns number

RGBHexOptions

RGBHexOptions: { alpha?: undefined | false | true; minify?: undefined | false | true }

Type declaration

  • Optional alpha?: undefined | false | true
  • Optional minify?: undefined | false | true

RawInput

RawInput: RawRGB | RawHSL | RawHSV | RawHEX | RawNamed

Rule

Rule: { range?: undefined | { max: number; min: number }; type: "string" | "number" | "boolean" }

Type declaration

  • Optional range?: undefined | { max: number; min: number }
  • type: "string" | "number" | "boolean"

Functions

Const enforceHSL

  • enforceHSL(hsl?: Partial<HSL>): HSL

Const enforceHSV

  • enforceHSV(hsv?: Partial<HSV>): HSV

Const enforceHex

  • enforceHex(hex?: Partial<HEX>): HEX

Const enforceNamed

Const enforceRGB

  • enforceRGB(rgb?: type.Optional<Partial<RGB>>): RGB

Const hexToRgb

Const hslToHsl

Const hslToRgb

Const hsvToHsv

Const hsvToRgb

Const inputToRGB

  • inputToRGB(input: Input): RGB | undefined

Const loop

Const namedToRgb

  • namedToRgb(named?: Partial<Named>): RGB | undefined

Const rgbToHex

  • Converts an RGBA color plus alpha transparency to hex Assumes r, g, b are contained in the set [0, 255] and a in [0, 1]. Returns a 4 or 8 character rgba hex

    Parameters

    Returns HEX

Const rgbToHsl

Const rgbToHsv

Const rgbToNamed

  • rgbToNamed(rgb: RGB): Named | undefined

Const rgbToRgb

  • rgbToRgb(rgb: type.Optional<Partial<RGB>>, type?: Type): RGB

Const roundedHSL

  • roundedHSL(hsl: HSL, digit?: undefined | number): HSL

Const roundedHSV

  • roundedHSV(hsv: HSV, digit?: undefined | number): HSV

Const roundedRGB

  • roundedRGB(rgb: RGB, digit?: undefined | number): RGB

Const stringToInput

  • stringToInput(color: string): Input | undefined
  • Permissive string parsing. Take in a number of formats, and output an object based on detected format. Returns { r, g, b } or { h, s, l } or { h, s, v}

    Parameters

    • color: string

      string color

    Returns Input | undefined

Const toDecimal

Const toNumber

Const toPercentage

Const toType

Const validateColorObject

  • validateColorObject(obj: type.Optional<C<string, any>>, condition: Condition): boolean

Const validateRGB

  • validateRGB(rgb: type.Optional<RGB>, withAlpha?: boolean): boolean

Object literals

Const defaultHSL

defaultHSL: object

a

a: number = 1

h

h: number = 0

l

l: number = 0

s

s: number = 0

type

type: "decimal" = "decimal"

Const defaultHSV

defaultHSV: object

a

a: number = 1

h

h: number = 0

s

s: number = 0

type

type: "decimal" = "decimal"

v

v: number = 0

Const defaultHex

defaultHex: object

a

a: number = 1

type

type: "hex" = "hex"

x

x: string = "000000"

Const defaultNamed

defaultNamed: object

a

a: number = 1

n

n: string = ""

Const defaultRGB

defaultRGB: object

a

a: number = 1

b

b: number = 0

g

g: number = 0

r

r: number = 0

type

type: "number" = "number"

Generated using TypeDoc