All files / color colorConstantsAndTypes.js

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                                                      18x 18x 18x 18x 18x 18x  
// @flow
 
// Note: Would love to have the types in separate files, but then documentation.js
// is not recognizing the types anymore.
 
/** */
export type HslColor = {
  hue: number,
  saturation: number,
  lightness: number,
}
 
/** */
export type HslaColor = {
  hue: number,
  saturation: number,
  lightness: number,
  alpha: number,
}
 
/** */
export type RgbColor = {
  red: number,
  green: number,
  blue: number,
}
 
/** */
export type RgbaColor = {
  red: number,
  green: number,
  blue: number,
  alpha: number,
}
 
export const hexRegex = /^#[a-fA-F0-9]{6}$/
export const reducedHexRegex = /^#[a-fA-F0-9]{3}$/
export const rgbRegex = /^rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)$/
export const rgbaRegex = /^rgba\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3}), ?([-+]?[0-9]*[.]?[0-9]+)\)$/
export const hslRegex = /^hsl\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%\)$/
export const hslaRegex = /^hsla\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%, ?([-+]?[0-9]*[.]?[0-9]+)\)$/