aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/colorRules/foregroundCheck.js
blob: 2cf2b5f2f5e28d91661457e7fe17622274088074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
exports.name = 'Background Check';

exports.description =
  [ 'Backgrounds colors should be in the set:'
  , '#00 #FF #3D #F7 #C2 #B4 #4E'
  ].join('\n');

exports.rule = function() {
  var allow = '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'.split(' ');
  $5(':visible')
    .cssIsNot('color', allow, fiveui.color.colorToHex)
    .each(function(i, elt) {
            var color = fiveui.color.colorToHex($(elt).css('color'));
            this.report('foreground color: ' + color, elt);
          });
};