Marc Nijdam

Mental pressure relief valve

UIColor Shortcuts Revisited

Following up on a previous post on utilities for creating UIColor objects. I’ve started work on a new project where the designers prefer to work with web style colors in the typical CSS format #c5c5c5.

Needing to convert those to the floating point format I prefered in my previous post was laborious and didn’t allow for quick turn color changes with the designer.

Enter RGBX and RGBXA:

Which allow for UIColors to be created by coying the hex values from the design documents doing:

RGBX(0xc5c5c5);
RGBXA(0xc5c5c5, 0.8);

This reduced friction with in translating the visual design a lot for me. I hope it does for you to.