Added default colours from theme.

This commit is contained in:
Devine Lu Linvega 2019-08-02 08:06:36 +09:00
parent f8e202f1b6
commit d2004ce7cd
3 changed files with 8 additions and 4 deletions

View File

@ -42,6 +42,10 @@ function Theme (_default) {
this.load(_default) this.load(_default)
} }
this.get = function (key) {
return this.active[key]
}
function parse (any) { 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) } 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 return null

View File

@ -5,7 +5,7 @@ function Ronin () {
f_med: '#999', f_med: '#999',
f_low: '#444', f_low: '#444',
f_inv: '#000', f_inv: '#000',
b_high: '#000', b_high: '#72dec2',
b_med: '#888', b_med: '#888',
b_low: '#aaa', b_low: '#aaa',
b_inv: '#ffb545' b_inv: '#ffb545'

View File

@ -29,7 +29,7 @@ function Surface (ronin) {
// Shape // 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() context.beginPath()
this.trace(shape, context) this.trace(shape, context)
context.lineWidth = width context.lineWidth = width
@ -52,9 +52,9 @@ function Surface (ronin) {
// Fill // Fill
this.fill = (shape, color, context = this.context) => { this.fill = (shape, color = ronin.theme.get('b_high'), context = this.context) => {
context.beginPath() context.beginPath()
context.fillStyle = color.hex ? color.hex : color context.fillStyle = typeof color === 'object' && color.hex ? color.hex : color
this.trace(shape, context) this.trace(shape, context)
if (isText(shape)) { if (isText(shape)) {
context.textAlign = shape.a context.textAlign = shape.a