aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/colorRules.json
blob: 8f10ee87f324aecda865ac058858aa51cd328e71 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* colorRules.json
 *
 * Simple rules for checking that the colors of specific elements are in a specific set.
 * Test using exampleData/basic/testColorRules.html
 */

{ 'name': 'Color Guidelines'
, 'description': 'Foreground/background color guidelines'
, 'rules': [
  //----------------------------------------------------------------
  { 'id': 2141101
  , 'name': 'Foreground check'
  , 'description': 'Foreground colors should be in the set:'+
                   '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'
  , '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'));
        report('foreground color: ' + color, elt);
      });
  }
  },
  //----------------------------------------------------------------
  { 'id': 2141102
  , 'name': 'Background check'
  , 'description': 'Backgrounds colors should be in the set:' +
                   '#00 #FF #3D #F7 #C2 #B4 #4E'
  , 'rule':
  function() {
    var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' ');
    $5(':visible')
      .cssIsNot('background-color', allow, fiveui.color.colorToHex)
      .each(function(i, elt) {
        var color = fiveui.color.colorToHex($(elt).css('background-color'));
        report('non-standard background color: ' + color, $(elt));
      });
  }
  },
  //----------------------------------------------------------------
  { 'id': 2141103
  , 'name': 'Content area color'
  , 'description': 'Background color should be: ' +
                   '#F7'
  , 'rule':
  function() {
    var allow = '#F7';
    $5('#content')
      .cssIsNot('background-color', allow, fiveui.color.colorToHex)
      .each(function(i, elt) {
        var color = fiveui.color.colorToHex($(elt).css('background-color'));
        report('non-standard content background color: ' + color, elt);
      });
  }
  },
  //----------------------------------------------------------------
  { 'id': 2141104
  , 'name': 'Left navigation color'
  , 'description': 'Left navigation color should be: ' +
                   '#C2'
  , 'rule':
  function() {
    var allow = '#C2';
    $5('#leftNav')
      .cssIsNot('color', allow, fiveui.color.colorToHex)
      .each(function(i, elt) {
        var color = fiveui.color.colorToHex($(elt).css('color'));
        report('non-standard left navigation color: ' + color, elt);
      });
  }
  },
  //----------------------------------------------------------------
  { 'id': 2141105
  , 'name': 'Header color check'
  , 'description': 'Header color should be: ' +
                   '#3D'
  , 'rule':
  function() {
    var allow = '#3D';
    $5(':header')
      .cssIsNot('color', allow, fiveui.color.colorToHex)
      .each(function(i, elt) {
        var color = fiveui.color.colorToHex($(elt).css('color'));
        report('non-standard header color: ' + color, elt);
      });
  }
  }//,
  //----------------------------------------------------------------
]
}