Sketch Plug-in: Dark Theme
I published a Sketch plug-in that switching designs from light / dark themes instantly.
Goal
During my work at Parkmobile, iOS and the rest of the world launched dark mode. All mobile designs had to go through to a double process: design it first, then replace each component with its dark / light mode equivalent. I found this very boring and redundant — a job that should be easily automated.
Since my work was done in Sketch at the moment, and Sketch did not provide an official method to accomplish a quick light/dark theme switch of designs, I decided to create my own.
doing this for every component just didn’t make sense
I’m familiar with programming in general, but this time it was entirely differnet. I had to learn the Git method of working with branched, pull requests, and to deep dive into the Sketch API logic. On top of that, the code was supposed to be JavaScript, something I didn’t really try before.
The algorithm was straightforward — theoretically. Libraries in Sketch are based on name trees, e.g.
If my plug-in can go through the tree, in a reverse order, it could figure out precisely which component was used, what type and what theme. Since names are the same, until the theme, it would replace the component with the same one, but with ..../ Dark or ..../ Light at the end — thus reversing the theme.
Obviously this wasn’t straightforward at all. The community of people already working on plug-ins helped a lot. I’ve also involved several designers to test the plug-in while developing it to see what feels good or bad in real world examples.
In the end, I managed to get to a robust solution that’s currently used occasionally in Parkmobile. It simplifies my work quite a lot, by taking away the manual part of selecting each components’ dark/light mode equivalent. It’s also a good method of testing your Sketch library. If names are not correctly written, the plug-in isn’t able to pick up the right component.
It works with multiple selections, external libraries, Abstract, text styles and colour styles. I’m currently trying to fix groups, there seems to be an issue there. A more friendly UI would also work better - to explain how the plug-in work.
It’s in the Sketch official plug-in directory at the moment.