Package Exports
- d3-color
- d3-color/index
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 (d3-color) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
d3-color
Colorspaces! This code is currently EXPERIMENTAL and represents the in-development D3 4.0 API. The 4.0 API is largely backwards-compatible, but differs from 3.x in several ways:
Parsing RGB colors with percentages is now supported (e.g.,
rgb(30%,40%,50%)). Decimal values where integers are required are no longer allowed (e.g.,rgb(100.5,0,0)is not a valid color).The rgb.brighter method no longer special-cases behavior for black and very dark channels; it is now a simple channel multiplier, consistent with rgb.darker and implementations in the other colorspaces.
The rgb.hsl method has been removed; use the hsl constructor to convert any color to the HSL colorspace (e.g.,
hsl(rgb)).All colorspaces, including RGB, now support the color.rgb method. This method returns a new color instance representing the nearest-equivalent color in the RGB colorspace.
Colors are now validated upon construction. For example, an RGB color’s
r,gandbvalues are integers in the range [0,100]. An HSL color’shis a number in the range [0,360), whilesandlare numbers in the range [0,1].A new color method parses the specified string according to CSS Color Module Level 3 and returns the corresponding color in its colorspace. For HSL color values, this is the HSL colorspace; for other values, the RGB colorspace is used.