Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Color

Color: Tagged<"Color", `#${string}`>

Colors are strings in the form #rrggbb.

HSV

HSV: { h: Degrees; s: Unit; v: Unit } & Tag<"HSV">

HSVSpec

HSVSpec: { h: number; s: number; v: number }

Type declaration

  • h: number
  • s: number
  • v: number

RGB

RGB: { b: Byte; g: Byte; r: Byte } & Tag<"RGB">

RGBSpec

RGBSpec: { b: number; g: number; r: number }

Type declaration

  • b: number
  • g: number
  • r: number

Variables

Const color_scheme

color_scheme: Color[] = ...

The supplied color scheme.

Functions

Const HSVtoRGB

Const RGBtoHSV

Const asColor

  • asColor(c: string): Color

Const asHSV

Const asRGB

Const colorsFor

  • colorsFor(color_scheme: Color[], unknown?: Color): (keys: Iterable<string>) => ScaleOrdinal<string, Color, Color>
  • Compute a set of color mappings for items in a given set of keys. A higher-order function. Supply color_scheme (and optionally unknown), and it will return a a function that accepts a list of keys

    Parameters

    • color_scheme: Color[]

      a list of colors in '#rrggbb' format.

    • unknown: Color = ...

      the color to use for unknown keys

    Returns (keys: Iterable<string>) => ScaleOrdinal<string, Color, Color>

    an object equivalent to a d3 ordinal interpolator.

      • (keys: Iterable<string>): ScaleOrdinal<string, Color, Color>
      • Parameters

        • keys: Iterable<string>

        Returns ScaleOrdinal<string, Color, Color>

Const compute_colors

  • Compute a set of color mappings for items in a given set of scenarios. A higher-order function. Supply color_scheme (and optionally unknown), and it will return a a function that accepts a list of scenarios

    Parameters

    • color_scheme: Color[]

      a list of colors in '#rrggbb' format.

    • unknown: Color = ...

      the color to use for unknown keys

    Returns (scenario_list: Scenario[]) => ScaleOrdinal<string, Color, Color>

    a d3 ordinal interpolator.

Const default_colors

  • Accept a list of scenarios, and return the default color scheme to use.

    Parameters

    Returns ScaleOrdinal<string, Color, Color>

Const hsv

Const isHSV

Const isRGB

Const rgb

Const subcolors

  • subcolors(colors: ScaleOrdinal<string, Color, Color>, subdomain: string[]): ScaleOrdinal<string, Color, Color>
  • Subset a color interpolator to a subdomain. This is used to allow genenrating a swatch for just the relevant items.

    Parameters

    • colors: ScaleOrdinal<string, Color, Color>
    • subdomain: string[]

    Returns ScaleOrdinal<string, Color, Color>

    a d3 ordinal interpolator.

Generated using TypeDoc