As I haven’t found a way to let tags inherit the color of its tag group (nested tag) I’m writing a script for it where I get the color of the tags parent and then assigning it to the tag itself. The problem is that when I assign the parents color something is happening to it. Here’s my code and then the output:
(() => {
const app = Application("DEVONthink 3");
app.includeStandardAdditions = true;
const selection = app.selectedRecords();
selection.forEach(record => {
const parent = record.parents.uuid()
let parentRecord = app.getRecordWithUuid(String(parent))
console.log('(1) Parent color:', parentRecord.color())
record.color = parentRecord.color() // Give the color of the parent to the record.
console.log('(2) Records new color:', record.color())
record.color = [324232, 2342342, 4212352] // Set the color of the tag to some random and very high values (for demonstration).
console.log('(3) Records random color:', record.color())
})
})()
(1) Parent color: 0.501960813999176,0.001541161211207509,0.998504638671875
(2) Records new color: 0,0,0
(3) Records random color: 0.9474021792411804,0.7413138151168823,0.27537956833839417
What kind of color conversion is happening here? In what format are DP handeling colors? And how do I fix it?
#javascript