csx: color(str) doesn't work with named colors (like 'black', 'green', etc.)
ehahn9 opened this issue · comments
Eric Hahn commented
import { color } from 'csx';
const foo = color('#000') // => GOOD: rgb(0, 0, 0)
const bar = color('black') // => BAD: rgb(255, 0, 0)
The docs don't claim to support named colors, but the argument type implies it should:
export declare function color(value: ColorProperty): ColorHelper;
export type ColorProperty = Globals | Color;
type Color = NamedColor | DeprecatedSystemColor | "currentcolor" | string;
B1t commented
Named colors were originally supported but removed sometime over a year ago. Providing the definitions for all named colors made CSX unnecessarily heavy. In general, it is pretty easy to look up the hex, rgb, and hsl for named colors, so this was a technical tradeoff.