Skip to content

Commit 2f61560

Browse files
committed
Make comparison table color blind safe.
The CSS classes "green" and "red" were renamed to "equal" and "inequal". The red background has been replaced with white. Signed-off-by: Anders Bergh <anders1@gmail.com>
1 parent d4d091d commit 2f61560

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

coffee/comparison_table.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ supportsCanvas = do ->
111111
[evalStr, tf] = valX.testResults(valY, comparator)
112112
td.attr("title", "#{evalStr} // #{tf}")
113113
if tf
114-
td.addClass("green")
114+
td.addClass("equal")
115115
$table
116116

117117
@buildComparisonTableForIf = (values)->
@@ -122,7 +122,7 @@ supportsCanvas = do ->
122122
$td = $("<td>", class: "cell").html($("<div>", html: "&nbsp;")).appendTo($tr)
123123
val = (new Function("if(#{comp.asString}){return true}else{return false}"))()
124124
if val
125-
$td.addClass("green")
125+
$td.addClass("equal")
126126
expression = " if (#{comp.asString}) { /* #{if val then 'executes' else 'does not execute'} */ } "
127127
$("<td>", class: "expression").html(expression).appendTo($tr)
128128
$table

comparison-table.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ var EqualityTable = (function(cmpStr){
3535
_curRow.append($("<td />", {'class':'row header'}).html("If (<i>value</i>)"))
3636
var elem;
3737
$.each(comparisons, function(i){
38-
elem = $("<td />", {'class':'cell green'}).html("<div />")
38+
elem = $("<td />", {'class':'cell equal'}).html("<div />")
3939
if(comparisons[i]) {
40-
elem.addClass('green');
40+
elem.addClass('equal');
4141
elem.attr('title', "if("+comparisons[i]+"){/*--executes--*/}")
4242
} else {
43-
elem.addClass('red');
43+
elem.addClass('inequal');
4444
elem.attr('title', "if("+comparisons[i]+"){/*--does not execute--*/}")
4545
}
4646
_curRow.append(elem)
@@ -56,18 +56,18 @@ var EqualityTable = (function(cmpStr){
5656
elem = $("<td />", {'class': 'cell'}).html("<div />");
5757
if(cmpStr==="===") {
5858
if(comparisons[i]===comparisons[j]) {
59-
elem.addClass('green');
59+
elem.addClass('equal');
6060
elem.attr('title', ""+representations[i]+"==="+representations[j]+" » true ")
6161
} else {
62-
elem.addClass('red');
62+
elem.addClass('inequal');
6363
elem.attr('title', ""+representations[i]+"==="+representations[j]+" » false ")
6464
}
6565
} else if(cmpStr==="=="){
6666
if(comparisons[i]==comparisons[j]) {
67-
elem.addClass('green');
67+
elem.addClass('equal');
6868
elem.attr('title', ""+representations[i]+"=="+representations[j]+" » true ")
6969
} else {
70-
elem.addClass('red');
70+
elem.addClass('inequal');
7171
elem.attr('title', ""+representations[i]+"=="+representations[j]+" » false ")
7272
}
7373
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2>=== <smaller>(negated: !==)</smaller></h2>
5252
</p>
5353
</div>
5454
<div id="if-statement">
55-
<h2>A standard IF statement. If(<i>value</i>) {/*- green -*/} else { /*- red -*/ }</h2>
55+
<h2>A standard IF statement. If(<i>value</i>) {/*- green -*/} else { /*- white -*/ }</h2>
5656
<p>Note: This row does not match up with any of the rows in the other table.</p>
5757
</div>
5858
<div style="padding: 2px 20px">

js/comparison_table.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

simple.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ table.comparisons td.cell div {
1818
-moz-border-radius: 3px;
1919
-webkit-border-radius: 3px;
2020
border-radius: 3px;
21-
background-color: #ed9e98;
22-
border-color: #be120d;
21+
background-color: white;
22+
border-color: #b1b1b1;
2323
}
24-
table.comparisons td.cell.green div {
24+
table.comparisons td.cell.equal div {
2525
background-color: #5bbe5b;
2626
border-color: #0b6c0b;
2727
}

0 commit comments

Comments
 (0)