Hi Matt

> Is there a recommended way of getting palette colors in JavaScript? I think I 
> need this for working with HTML custom elements where CSS outside of the 
> shadow shadow DOM cannot apply.
> 
> This is what I'm doing right now:
> 
>   twColor(colorName){
>     return $tw.wiki.extractTiddlerDataItem(
>       $tw.wiki.getTiddlerText("$:/palette","$:/palettes/Vanilla"),
>       colorName
>     );
>   }


There’s a bit more to it than that because palette colours can indirect through 
to other colours (e.g. in the default “Vanilla” palette, the colour 
"blockquote-bar” is set to "<<colour muted-foreground>>”).

But, it turns out that the core erroneously uses the above technique in a 
recent update to the framed editor:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js#L45
 
<https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js#L45>
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js#L100
 
<https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js#L100>

I’ve raised a ticket proposing that we add a core API for obtaining palette 
values, and then use it to correct those cases.

https://github.com/Jermolene/TiddlyWiki5/issues/4242 
<https://github.com/Jermolene/TiddlyWiki5/issues/4242>

Best wishes

Jeremy


> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/b531c512-9404-4b4e-ab23-3e471ba70e40%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywikidev/b531c512-9404-4b4e-ab23-3e471ba70e40%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/80CA0B63-B1FB-494C-9594-E345A1AC8902%40gmail.com.

Reply via email to