From 1f9d1e1eebce3ed0457affacdad3a53fe8809039 Mon Sep 17 00:00:00 2001 From: arT2 <60965610+etrusci-org@users.noreply.github.com> Date: Mon, 10 Jul 2023 12:42:05 +0200 Subject: [PATCH] Overrideable color list --- app/mod/colorfader.conf.js | 21 ++++++++++++--------- app/mod/colorfader.js | 8 +++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/mod/colorfader.conf.js b/app/mod/colorfader.conf.js index a9e6878..01981ba 100644 --- a/app/mod/colorfader.conf.js +++ b/app/mod/colorfader.conf.js @@ -7,7 +7,7 @@ export const modConf = { /** * fade to next color duration in seconds. */ - duration: '3', + duration: '30', /** * fade timing function to use. @@ -24,22 +24,25 @@ export const modConf = { * whether to use randomized colors or the values from the colors list below. * true or false. */ - random: 'false', + random: 'true', /** - * if random is set to true, colors values from this list will be used. + * if random is set to false, color values from this list will be used. * any valid css color value should work. e.g. hex, rgb, hsl, etc. + * start each item with |. + * use backticks (`) here so you can span it over multiple lines (better readability). + * you can also put it on one line like so: '|#ff0000|#00ff00|#0000ff'. * color picker: https://duckduckgo.com/?t=ffab&q=color+picker&ia=answer */ - list: [ - '#ff0000', - '#00ff00', - '#0000ff', - ], + list: ` + |#ff0000 + |#00ff00 + |#0000ff + `, /** * whether to shuffle the colors list. * true or false. */ - shuffle: 'true', + shuffle: 'false', } diff --git a/app/mod/colorfader.js b/app/mod/colorfader.js index aeed4d7..5e33551 100644 --- a/app/mod/colorfader.js +++ b/app/mod/colorfader.js @@ -30,7 +30,13 @@ export class Mod extends ModBase } else { if (this.queue.length == 0) { - this.queue = [...this.conf.list] + for (const item of this.conf.list.split('|')) { + const value = item.trim() + if (value) { + this.queue.push(value) + } + } + if (this.conf.shuffle == 'true') { this.queue = fyShuffle(this.queue) }