« get me outta code hell

data: provide default wiki color in data, not css - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-10 17:48:48 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-10 17:49:59 -0400
commit75ec07ac18cb91eb2e019aefce8f60488d794de1 (patch)
tree6492a1000b90ab325b19aaf80b37c6a792e6ffee /src/data
parent3f236319355b093b336e70119a7127bd23693ec2 (diff)
data: provide default wiki color in data, not css
Fixes #169!
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/wiki-info.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index 89053d62..3db9727b 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -1,9 +1,8 @@
 import {input} from '#composite';
 import find from '#find';
-import {isLanguageCode, isName, isURL} from '#validators';
+import {isColor, isLanguageCode, isName, isURL} from '#validators';
 
 import {
-  color,
   flag,
   name,
   referenceList,
@@ -32,7 +31,14 @@ export class WikiInfo extends Thing {
       },
     },
 
-    color: color(),
+    color: {
+      flags: {update: true, expose: true},
+      update: {validate: isColor},
+
+      expose: {
+        transform: color => color ?? '#0088ff',
+      },
+    },
 
     // One-line description used for <meta rel="description"> tag.
     description: simpleString(),