Options
All
  • Public
  • Public/Protected
  • All
Menu

Encapulates some common color operations useful for making symbology. Primary use is to generate the RGB hexidecimal color code for a color in HSV (hue, saturation, value) color space. This is far preferable to using RGB for mapping applications, as random colors generated in RGB will trend towards the dark and unsaturated, and often look quite similar. To use, supply a number between 0 and 1 for each of hue, saturation, and value. To generate a series of random colors with a consistent tone, supply a random number for 'hue' only.

Hierarchy

  • SymbolColor

Index

Constructors

constructor

  • SymbolColor can be instantiated with HSV values, RGB values, or a string (either RGBA or hex) Most raw values supplied should be in the range 0..1, though RGB can also be supplied in byte form The intent is not to have to worry about what kind of color representation you have -- just toss it in here and it works

    Parameters

    • color: HSV | RGB | string | Color

    Returns SymbolColor

Properties

alpha

alpha: number

hue

hue: number

saturation

saturation: number

value

value: number

Methods

blend

  • Blend this color with another by an amount and return a new color Uses linear interpolation in the RGB colorspace.

    Parameters

    • amount: number

      ranges from 0..1

    • color: SymbolColor

      another instance of SymbolColor

    Returns SymbolColor

darken

  • darken(amount: number, includeAlpha?: boolean): SymbolColor
  • Darkens the color by an amount and returns a hex string

    Parameters

    • amount: number

      ranges from 0..1

    • Optional includeAlpha: boolean

    Returns SymbolColor

equals

  • Is this color the same as the supplied color?

    Parameters

    Returns boolean

lighten

  • lighten(amount: number, includeAlpha?: boolean): SymbolColor
  • Lightens the color by an amount and returns a hex string

    Parameters

    • amount: number

      ranges from 0..1

    • Optional includeAlpha: boolean

    Returns SymbolColor

setAlpha

  • Return a new SymbolColor with the transparency set to alpha

    Parameters

    • alpha: number

    Returns SymbolColor

toEsriColor

  • toEsriColor(includeAlpha?: boolean): Color
  • Convert to an instance of esri.Color

    Parameters

    • Optional includeAlpha: boolean

    Returns Color

toHex

  • toHex(): string
  • Returns a hexidecimal string representing the color.

    Returns string

toRGB

toRGBAString

  • toRGBAString(): string
  • Returns a string like "rgba(255, 255, 255, 1)" representing the color.

    Returns string