aboutsummaryrefslogtreecommitdiff
path: root/benchmark/scripts/benchmark.js
blob: d62ae33a4171e5451f04793fe1311ffc7d84a2bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Benchmark()
{
  this.refresh = function(theme = this)
  {
    let el = document.getElementById("print")
    let html = ""
    let count = 0
    for(let fid in theme.active){
      if(fid.substr(0,1) != "f" || fid.indexOf("_inv") > -1){ continue; }
      let fc = theme.active[fid]
      for(let bid in theme.active){
        if(bid.substr(0,1) != "b" || bid.indexOf("_inv") > -1){ continue; }
        let bc = theme.active[bid]
        let rating = new Color(fc).contrast(new Color(bc));
        if(rating < 3){
          html += `Low contrast(${rating.toFixed(2)}): <b>${fid}</b> ${bid} <i>${bc}</i>\n`  
        }
        count += 1
      }
    }
    el.innerHTML = count > 0 ? `${html}\n<i>${count} conflicts</i>\n\n` : ""
  }
}