d3/d3-hcg

Name: d3-hcg

Owner: D3

Description: The HCG (Hue, Chroma, Grayness) color space derived from the Munsell color system.

Created: 2016-07-01 18:37:07.0

Updated: 2017-12-12 03:09:40.0

Pushed: 2017-02-26 04:16:56.0

Homepage:

Size: 13

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits
John Schulz2017-02-21 03:26:10.01
Mike Bostock2016-08-30 19:21:08.05
Sergey V2017-02-26 04:16:37.011

Other Committers

UserEmailMost Recent Commit# Commits

README

d3-hcg

This module implements the HCG (Hue, Chroma, Grayness) color space.

Installing

If you use NPM, npm install d3-hcg. Otherwise, download the latest release. You can also load directly from d3js.org as a standalone library. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3 global is exported:

ipt src="https://d3js.org/d3-color.v1.min.js"></script>
ipt src="https://unpkg.com/d3-hcg@0.0"></script>
ipt>

yellow = d3.hcg("yellow"); // {h: 60, c: 1, g: 0, opacity: 1}

ript>

Try d3-hcg in your browser.

API Reference

# d3.hcg(h, c, g[, opacity])
# d3.hcg(specifier)
# d3.hcg(color)

Constructs a new HCG color. The channel values are exposed as h, c and g properties on the returned instance.

If h, c and g are specified, these represent the channel values of the returned color; an opacity may also be specified. If a CSS Color Module Level 3 specifier string is specified, it is parsed and then converted to the HCG color space. See d3.color for examples. If a color instance is specified, it is converted to the RGB color space using color.rgb and then converted to HCG.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.