Changing HIG themes at runtime in a Forge application

Despite the unfolding horror of the situation with Covid-19 – and stuff is really starting to hit the fan, here in Switzerland, with schools and non-essential commerces being closed and rumours of an enforced sequestration being considered – I’m at least getting some quality time to work on Dasher.

Theme setting UI inside Dasher

Last week we saw how it was possible to support both dark and light themes from the Autodesk HIG in a Forge viewer application. I mentioned both times my desire to allow Dasher’s theme to be selected by the user at runtime. After searching fruitlessly on the internet for some time, I ended up asking an internal Slack channel focused on HIG-related development. Within a day Yong Wu from the Revit team came back with some code they had created to get this working on their side.

Yong and team had basically used the approach shown in this excellent article. Sass is a pre-processor for CSS – it’s a build-time component, so isn’t available at runtime – which means that you…

Read more