Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "geocortex/infrastructure/ColorUtils"

Index

Functions

generateRandomColor

  • Generate a random saturated color

    Returns SymbolColor

generateRandomColors

  • Generate a selection of random colors that can be used in symbolization. An attempt has been made to constrain the selection to colors that will 'look good' while providing the most diverse set of colors possible. Use for up to 12 colors is generally ok.

    Parameters

    • Optional n: number

    Returns SymbolColor[]

getColorFromList

  • getColorFromList(colorList: number[]): Color
  • Creates a color with the provided number array representation of the color, or null if one can not be created.

    Parameters

    • colorList: number[]

      A 3 or 4 element list in the order RGB or RGBA.

    Returns Color

    color

getColorFromString

  • getColorFromString(color: string): Color
  • Creates a color with the provided hex string of the color, or null if one can not be created.

    Parameters

    • color: string

      A 6 or 8 digit hex in RGB or ARGB form.

    Returns Color

    color

getStringFromHex

  • getStringFromHex(hexColor: string): string
  • Creates a CSS color string with the provided hex string of the color.

    Parameters

    • hexColor: string

      The 6 or 8 digit hex string in RGB or ARGB form.

    Returns string

    The CSS color string or null.

getStringFromList

  • getStringFromList(colorList: number[]): string
  • Creates a CSS color string with the provided number array representation of the color.

    Parameters

    • colorList: number[]

      A 3 or 4 element list in the order RGB or RGBA.

    Returns string

    The CSS color string or null.

isColorInputSupported

  • isColorInputSupported(): boolean
  • Detect whether or not the native color input type is supported by the current browser. Returns true when color input is supported, false otherwise.

    Returns boolean