[SOLVED] How would I color individual dropdown labels? Or how would I add an icon to each?

I think this is referring to victordcq's js/html injection technique using the markdown component:

https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Markdown

I've never tried it but there's some example projects that might shed some light on how it's done:

If I figure out how exactly to use it, I'll reply with more details. Or maybe someone else will chime in.

EDIT: I got it working like this.
So the injection works on the dropdown option's label value, in this case, "YourLabel".

Somewhere on the same view, you want a markdown component, it can probably be invisible but in this case I have it visible because I'm just using the existing example:

image

Make sure the markdown.escapeHtml prop is set to false and the binding you want to set is on the source prop:


The injection payload goes inside the script transform.

3 Likes