From d2004ce7cd2d2e5019311317f70c820a77960760 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 2 Aug 2019 08:06:36 +0900 Subject: [PATCH] Added default colours from theme. --- desktop/sources/scripts/lib/theme.js | 4 ++++ desktop/sources/scripts/ronin.js | 2 +- desktop/sources/scripts/surface.js | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js index 2618d9a..bd94945 100644 --- a/desktop/sources/scripts/lib/theme.js +++ b/desktop/sources/scripts/lib/theme.js @@ -42,6 +42,10 @@ function Theme (_default) { this.load(_default) } + this.get = function (key) { + return this.active[key] + } + function parse (any) { if (any && any.background) { return any } else if (any && any.data) { return any.data } else if (any && isJson(any)) { return JSON.parse(any) } else if (any && isHtml(any)) { return extract(any) } return null diff --git a/desktop/sources/scripts/ronin.js b/desktop/sources/scripts/ronin.js index 550157d..4f5738a 100644 --- a/desktop/sources/scripts/ronin.js +++ b/desktop/sources/scripts/ronin.js @@ -5,7 +5,7 @@ function Ronin () { f_med: '#999', f_low: '#444', f_inv: '#000', - b_high: '#000', + b_high: '#72dec2', b_med: '#888', b_low: '#aaa', b_inv: '#ffb545' diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index e4d9ce5..18c16a0 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -29,7 +29,7 @@ function Surface (ronin) { // Shape - this.stroke = (shape, color, width, context = this.context) => { + this.stroke = (shape, color = ronin.theme.get('b_high'), width = 2, context = this.context) => { context.beginPath() this.trace(shape, context) context.lineWidth = width @@ -52,9 +52,9 @@ function Surface (ronin) { // Fill - this.fill = (shape, color, context = this.context) => { + this.fill = (shape, color = ronin.theme.get('b_high'), context = this.context) => { context.beginPath() - context.fillStyle = color.hex ? color.hex : color + context.fillStyle = typeof color === 'object' && color.hex ? color.hex : color this.trace(shape, context) if (isText(shape)) { context.textAlign = shape.a