All files / plugins colors.js

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 413x   3x             3x                                                              
const {createVariableRule} = require('./lib/variable-rules')
 
const bgVars = [
  '$bg-*',
  '$tooltip-background-color',
  // Match variables in any of the following formats: --color-bg-*, --color-*-bg-*, --color-*-bg
  /var\(--color-(.+-)*bg(-.+)*\)/
]
 
module.exports = createVariableRule(
  'primer/colors',
  {
    'background-color': {
      expects: 'a background color variable',
      values: bgVars.concat('none', 'transparent')
    },
    background: {
      expects: 'a background color variable',
      values: bgVars.concat('none', 'transparent', 'top', 'right', 'bottom', 'left', 'center', '*px', 'url(*)')
    },
    'text color': {
      expects: 'a text color variable',
      props: 'color',
      values: [
        '$text-*',
        '$tooltip-text-color',
        'inherit',
        // Match variables in any of the following formats: --color-text-*, --color-*-text-*, --color-*-text
        /var\(--color-(.+-)*text(-.+)*\)/
      ],
      replacements: {
        '#fff': '$text-white',
        white: '$text-white',
        '#000': '$text-gray-dark',
        black: '$black'
      }
    }
  },
  'https://primer.style/css/utilities/colors'
)