From 60e85440588fa9c52ae2d856c1e53126935222a4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 15 Apr 2023 19:47:04 -0300 Subject: content: linkThing: add color: false slot option This behaves like the old codebase, disabling automatically grabbing the color from the thing being linked. --- src/content/dependencies/linkThing.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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) { -- cgit 1.3.0-6-gf8a5