From f7e20d0ae0273dbb9bc2c86a4715e53707279aee Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 9 Nov 2019 11:11:11 -0500 Subject: * --- editor/scripts/benchmark.js | 7 +++---- editor/scripts/color.js | 2 ++ editor/scripts/lib/theme.js | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'editor/scripts') diff --git a/editor/scripts/benchmark.js b/editor/scripts/benchmark.js index 84c6d1b..69032b2 100644 --- a/editor/scripts/benchmark.js +++ b/editor/scripts/benchmark.js @@ -16,6 +16,7 @@ function Benchmark () { } this.refresh = function () { + console.log('refresh') const el = document.getElementById('print') const html = '' const count = 0 @@ -23,9 +24,9 @@ function Benchmark () { console.log(matches) for (const match of matches) { + const rating = new Color(match.fc).contrast(new Color(match.bc)) const cell = document.getElementById(match.id) - console.log(cell, match.id) - // cell.textContent = '0.0' + cell.textContent = `${rating.toFixed(2)}` } el.innerHTML = html @@ -34,8 +35,6 @@ function Benchmark () { this.log = function (id, fc, bc) { let html = '' - const rating = new Color(fc).contrast(new Color(bc)) - if (rating == 1) { html += `Overlap: ${id} ${bc}\n` } else if (rating < 1.5) { diff --git a/editor/scripts/color.js b/editor/scripts/color.js index 8296e1e..3aebfc7 100644 --- a/editor/scripts/color.js +++ b/editor/scripts/color.js @@ -1,3 +1,5 @@ +'use strict' + function Color (hex = '#000000') { this.hex = hex diff --git a/editor/scripts/lib/theme.js b/editor/scripts/lib/theme.js index 6a01c24..abb491b 100644 --- a/editor/scripts/lib/theme.js +++ b/editor/scripts/lib/theme.js @@ -21,6 +21,9 @@ function Theme (client) { b_inv: '#ffb545' } + // Callbacks + this.onLoad = () => {} + this.install = (host = document.body) => { window.addEventListener('dragover', this.drag) window.addEventListener('drop', this.drop) -- cgit v1.2.3