Skip to main content
Alan_AEDScripts
Inspiring
December 9, 2013
Question

Color Labels

  • December 9, 2013
  • 2 replies
  • 4957 views

What kind of data are label colors being saved as in prefs ?

I know this was discussed in a post but can't find the exact post....

Thanks

Alan.

"Label Color ID 2 # 1" = FFB60505

          "Label Color ID 2 # 10" = FF8E","9A

          "Label Color ID 2 # 11" = FFC8"~"0C

          "Label Color ID 2 # 12" = FF7F"E*"

This topic has been closed for replies.

2 replies

zsaaro
Inspiring
April 21, 2022
Legend
December 10, 2013

I would assume string given that prefs can be saved or retrieved via these methods:

app.preferences

     .deletePref()

     .getPrefAsBool()

     .getPrefAsFloat()

     .getPrefAsLong()

     .getPrefAsString()

     .havePref()

     .reload()

     .savePrefAsBool()

     .savePrefAsFloat()

     .savePrefAsLong()

     .savePrefAsString()

     .saveToDisk()

Alan_AEDScripts
Inspiring
December 11, 2013

Thanks David, but I am trying to figure out how the colours are represented in these strings, don't recognise the data format...

thanks.

stib
Inspiring
April 5, 2019

This is what I got to work with AE16.1 (Apr 19)

function asciiToRGB(str) { 

    var arr = []; 

    for (var i = 1, l = str.length; i < l; i ++) { 

    var hex = Number(str.charCodeAt(i)).toString(16); 

    arr.push(parseInt(hex, 16)/65533); 

    } 

    return arr; 

}

var colours = [];

for (var i = 1; i <= 16; i++){

    var sect = "Label Preference Color Section 5"; 

    var key = "Label Color ID 2 # " + i.toString(); 

    var prefType = PREFType.PREF_Type_MACHINE_INDEPENDENT

    var thePref = app.preferences.getPrefAsString(sect,key, prefType); 

    colours[i-1] =  asciiToRGB(thePref);

}

This is just for reading the label colours, I haven't worked out the writing side, but I'm guessing it will just be the reverse.


Ahh, close, but no biscuit. It works for some of the colours, but not for others.

@Adobe, please tell us how the label colours are encoded in the prefs, or make the RGB label values accessible to scripting somehow. It's so frustrating.