2.0.2 • Published 10 hours ago
@csstools/css-color-parser v2.0.2
CSS Color Parser
Usage
Add CSS Color Parser to your project:
npm install @csstools/css-color-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
import { color } from '@csstools/css-color-parser';
import { isFunctionNode, parseComponentValue } from '@csstools/css-parser-algorithms';
import { serializeRGB } from '@csstools/css-color-parser';
import { tokenize } from '@csstools/css-tokenizer';
// color() expects a parsed component value.
const hwbComponentValue = parseComponentValue(tokenize({ css: 'hwb(10deg 10% 20%)' }));
const colorData = color(hwbComponentValue);
if (colorData) {
console.log(colorData);
// serializeRGB() returns a component value.
const rgbComponentValue = serializeRGB(colorData);
console.log(rgbComponentValue.toString());
}
2.0.2
10 hours ago
2.0.1
15 hours ago
2.0.0
14 days ago
1.6.3
1 month ago
1.6.2
2 months ago
1.6.1
2 months ago
1.6.0
2 months ago
1.5.2
3 months ago
1.5.1
4 months ago
1.5.0
5 months ago
1.3.3
7 months ago
1.3.2
7 months ago
1.2.3
10 months ago
1.4.0
7 months ago
1.3.1
8 months ago
1.2.2
10 months ago
1.3.0
8 months ago
1.2.0
12 months ago
1.2.1
11 months ago
1.1.2
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.0
1 year ago