aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/colorRules.json
diff options
context:
space:
mode:
Diffstat (limited to 'exampleData/ruleSets/colorRules.json')
-rw-r--r--exampleData/ruleSets/colorRules.json53
1 files changed, 53 insertions, 0 deletions
diff --git a/exampleData/ruleSets/colorRules.json b/exampleData/ruleSets/colorRules.json
new file mode 100644
index 0000000..5dfb7ca
--- /dev/null
+++ b/exampleData/ruleSets/colorRules.json
@@ -0,0 +1,53 @@
+{ 'name': "Colors are in a specified set"
+, 'description': "All background and foreground colors used on a page should be in a specificed set"
+, 'rules': [
+ { 'image-appears': "Foregrounds"
+ , 'description': "Foreground colors are in a specified set"
+ , 'rule':
+ function() { //----------------------------------------------
+ var allowableColors = { '#0': 1, '#FFFFFF': 1, '#3D3D3D': 1,
+ '#B4B4B4': 1, '#4E4E4E': 1, '#C2C2C2': 1,
+ '#F7F7F7': 1 };
+ fiveui.query(':visible').each(
+ function(i, elt) {
+ var color = $(elt).css('color');
+ // console.log('color: ' + color + ' --> ' + fiveui.colorToHex(color));
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Disallowed FOREground color appears');
+ }
+ });
+ } //---------------------------------------------------------
+ },//==============================================================
+ { 'image-appears': "Backgrounds"
+ , 'description': "Backgrounds colors are in a specified set"
+ , 'rule':
+ function() { //----------------------------------------------
+ var allowableColors = { '#0': 1, '#FFFFFF': 1,
+ '#3D3D3D': 1, '#B4B4B4': 1, '#4E4E4E': 1,
+ '#C2C2C2': 1 };
+ fiveui.query(':visible').each(
+ function(i, elt) {
+ var color = $(elt).css('background-color');
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Disallowed BACKground color appears');
+ }
+ });
+ } //---------------------------------------------------------
+ },//==============================================================
+ { 'image-appears': "Content Area Color"
+ , 'description': "Content Area Color is #F7"
+ , 'rule':
+ //----------
+ function() {
+ var allowableColors = { '#F7F7F7': 1 };
+ fiveui.query("div[id='content'").each(
+ function(i, elt) {
+ var color = $(elt).css('color');
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Invalid color in content area');
+ }
+ });
+ } //---------------------------------------------------------
+ } //==============================================================
+ ]
+}