FORMR PLUGIN FOR SKETCH.APP
Sometimes while working with Sketch we face situations where we need to maintain simple proportions of layers and artboards.
By simple proportions I mean 1:2, 2:3 and the like. Sometimes it could be more technical, say, widescreen ratio of 16:9, etc. So it could be handy to have a tool to apply this ratios.
A couple of weeks ago I’ve developed Formr plugin for Sketch that does just that: applies simple ratios to working elements. It took me two or three days to write code and another day to make videos, screenshots and finally create a simplistic landing page with Readymag.
It was truly an MVP product: it could do only one thing and had a very limited list of available ratios.
I’ve recently added new functionality and shipped second version of Formr. New, updated Formr can extract proportions from layer names, which, I hope, will save you couple of mouse clicks.
How to use
Install plugin either via Sketch Toolbox (neat!) or manually by downloading zip and double-clicking .sketchplugin file inside.
You can also use custom proportions by adding ::RATIO to the layer/artboard name where “RATIO” can be any simple fraction and than pressing ctrl+alt+shift+e. For example, adding ::1/2 to a 100×100 layer name and calling the plugin gets you 50×100 layer dimensions.
Formr supports layers, artboards, and multiple selection. It also works with latest versions of Sketch (3.8+ at the time of writing).
Helpful links and tools
- Console.app for debugging. It’s mind-boggling at first, but after some time it comes quite naturally. Here’s a great article by Ale Muñoz. Functionality of built-in plugin sandbox might be sufficient until your plugin structure grows and you won’t be able to debug it.
- Developer section on Sketch official website gives you a quick start. Some parts are badly structured and can be confusing in my opinion. While working on a plugin I had a constant feeling that Sketch plugins API is poorly documented, but, again, I may be wrong.
- Tutorial on building plugins by Yari D’areglia.
- I strongly recommend taking a look at the source code of some well-established plugins. Measure or Magic Mirror for instance.
- Check out this series by Magic Mirror’s author, James Tang.