aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/color/backgroundCheck.js
diff options
context:
space:
mode:
Diffstat (limited to 'exampleData/ruleSets/color/backgroundCheck.js')
-rw-r--r--exampleData/ruleSets/color/backgroundCheck.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/exampleData/ruleSets/color/backgroundCheck.js b/exampleData/ruleSets/color/backgroundCheck.js
new file mode 100644
index 0000000..eb070db
--- /dev/null
+++ b/exampleData/ruleSets/color/backgroundCheck.js
@@ -0,0 +1,17 @@
+
+exports.name = 'Foreground Check';
+
+exports.description =
+ [ 'Foreground colors should be in the set:'
+ , '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'
+ ].join('\n');
+
+exports.rule = function(report) {
+ 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.error('non-standard background color: ' + color, $(elt));
+ });
+};