Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"umd"
],
"scripts": {
"prepare": "npm run build",
"build": "npm run build:umd && npm run build:es5",
"build:umd": "NODE_ENV=production webpack src/index.js umd/index.js",
"build:es5": "NODE_ENV=production babel -d lib/ src/",
Expand Down Expand Up @@ -46,6 +47,7 @@
},
"dependencies": {
"classnames": "^2.2.0",
"color-name": "^1.1.4",
"create-react-class": "^15.0.0",
"prop-types": "^15.5.10",
"pure-color": "^1.2.0",
Expand Down
5 changes: 5 additions & 0 deletions src/util/ColorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import rgb2hsv from "pure-color/convert/rgb2hsv";
import hsv2rgb from "pure-color/convert/hsv2rgb";
import rgb2string from "pure-color/convert/rgb2string";
import rgb2grayscale from "pure-color/convert/rgb2grayscale";
import colorNames from "color-name";


export function parseToHsv(color) {
color = parse(color);
if (color === undefined && colorNames.hasOwnProperty(color)) {
// if the passed in value corresponds to a color name, parse it
color = parse('rgb(' + colorNames[color].join(',') + ')');
}
const hsv = rgb2hsv(color);

const alpha = color.length === 4 ? color[3] : 1;
Expand Down