Stylesheet Scripting

I'm going to go ahead and guess that there's no way to programmatically update the CSS stylesheet through scripting to alter themes "on-the-fly"? Might there be another way to do that? Maybe editing the actual stylesheet file on the gateway? I'm not sure where it's located.

What is the use case/reason behind wanting to?

1 Like

It looks like the file is located at:

C:\Program Files\Inductive Automation\Ignition\data\projects\PROJECT_NAME\com.inductiveautomation.perspective\stylesheet\stylesheet.css

You should be able to edit it externally (or via scripting), and the changes will be picked up every 5 minutes via the gateway.

I want to alter styles on the fly to see changes to variable (color) definitions in real-time and using a color picker, so I don't have to mess with hex codes so much. I could then use this to quickly make new styles using a script to save the current stylesheet as a style in the install directory.

Not sure about amarks, but I have ours setup to edit a different css file to add css definitions on a per-user basis

And I'm guessing that 5 minutes is constant? I can't force an update?

Supposedly, the ability to force an update is a planned feature:

1 Like

That's a slightly different ask; the asset managers that watch for themes, icon sheets, and fonts for Perspective are supposed to be automatic and pick up changes immediately.

I know some of the changes I make require me to log out and back in before they take affect, at least in the client.

1 Like

you can use the inspector in the browser to add and modify styles on the fly to have instant feedback, and copy the styles to your stylesheet

1 Like

That's what I was about to say. Seems to be the simplest and most effective solution to that use case.