« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/linkThing.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index fea68ae5..1e648ee6 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -37,9 +37,14 @@ export default {
 
         tooltip: {
           validate: v => v.oneOf(v.isBoolean, v.isString),
+          default: false,
+        },
+
+        color: {
+          validate: v => v.oneOf(v.isBoolean, v.isColor),
+          default: true,
         },
 
-        color: relations.linkTemplate.getSlotDescription('color'),
         attributes: relations.linkTemplate.getSlotDescription('attributes'),
         hash: relations.linkTemplate.getSlotDescription('hash'),
       },
@@ -56,7 +61,12 @@ export default {
           content = name;
         }
 
-        const color = slots.color ?? data.color ?? null;
+        let color = null;
+        if (slots.color === true) {
+          color = data.color ?? null;
+        } else if (typeof slots.color === 'string') {
+          color = slots.color;
+        }
 
         let tooltip = null;
         if (slots.tooltip === true) {