diff options
Diffstat (limited to 'exampleData/ruleSets/trac/colors.json')
-rw-r--r-- | exampleData/ruleSets/trac/colors.json | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/exampleData/ruleSets/trac/colors.json b/exampleData/ruleSets/trac/colors.json new file mode 100644 index 0000000..2e6a2cc --- /dev/null +++ b/exampleData/ruleSets/trac/colors.json @@ -0,0 +1,33 @@ +/* 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': [ + //---------------------------------------------------------------- + { 'name': "Foreground check" + , 'description': "Foreground colors should be in a certain fixed set." + , 'rule': + function () { + var allow = "rgb(0, 0, 0) " + + "rgb(255, 255, 255) " + + "rgb(85, 85, 85) " + + "rgb(34, 34, 34) " + + "rgb(187, 0, 0) " + + "rgb(238, 238, 238) " + + "rgb(153, 153, 136) " + + "rgb(136, 136, 136) " + + "rgb(102, 102, 102) " + + "rgb(187, 187, 187)".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); + }); + } +] +} |