JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 879
  • Score
    100M100P100Q13831F
  • License MIT

Color functions that extent the ability of d3-color.

Package Exports

  • d3plus-color

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (d3plus-color) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

d3plus-color

NPM Release Build Status Dependency Status Dependency Status

Color

Color functions that extent the ability of d3-color.

Kind: global class

new Color(color, [defaults])

Param Type Default
color Color | String | Number | true | false | null | undefined
[defaults] object src/defaults.js

color.add(c2) ⇒ Color

Mixes a second color, returning a new Color object.

Kind: instance method of Color

Param Type Description
c2 Color The color to be mixed in. If it is not a d3plus-color Object, then it will be parsed into one.

color.displayable() ⇒ Boolean

Returns true if the color is displayable.

Kind: instance method of Color

color.hex() ⇒ String

Returns the hexidecimal value.

Kind: instance method of Color

color.hsl()

Returns the D3 hsl object.

Kind: instance method of Color

color.legible() ⇒ Color

Darkens the color if it is too light to appear on white.

Kind: instance method of Color

color.lighter() ⇒ Color

Lightens the color while also reducing the saturation.

Kind: instance method of Color

color.rgb()

Returns the D3 rgb object.

Kind: instance method of Color

color.subtract(c2) ⇒ Color

Subtracts a second color, returning a new Color object.

Kind: instance method of Color

Param Type Description
c2 Color The color to be subtracted out. If it is not a d3plus-color Object, then it will be parsed into one.

color.text() ⇒ Color

Analyzes the color and determines an appropriate color for text to be placed on top of the color.

Kind: instance method of Color

color.toString() ⇒ String

Pass-through method for D3 toString function.

Kind: instance method of Color