Skip to content

Variable: CSS_HASH_COLOR ​

ts
const CSS_HASH_COLOR: Regex<"#(?<color>[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?)", {
  names: {
     color: string;
  };
}>;

Defined in: packages/regex/src/tiers/css-spec.ts:102

CSS hash color from W3C formal grammar.

followed by 3 or 6 hexadecimal digits. ​

Example ​

ts
CSS_HASH_COLOR.exec("#fff")?.groups?.color // "fff"
CSS_HASH_COLOR.exec("#ffffff")?.groups?.color // "ffffff"

Released under the MIT License