aboutsummaryrefslogtreecommitdiff
path: root/editor/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'editor/scripts')
-rw-r--r--editor/scripts/benchmark.js7
-rw-r--r--editor/scripts/color.js2
-rw-r--r--editor/scripts/lib/theme.js3
3 files changed, 8 insertions, 4 deletions
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: <b>${id}</b> <i>${bc}</i>\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)