Colour me (literally) unimpressed

Reading someone else's code is, at best, a bit of a chore. Now imagine if that person populated their code with unnecessary speedbumps that slowed you to a crawl, thanks to helpful "developer aids."

That's what I think of Swift playground's colour literals.

Playground shenanigans

I will admit it took me a while to get used to Swift playgrounds, but now I'm a convert. They were fiddly and originally I tried to put too much into them, but as time went on I embraced the scripting nature of Swift, which honestly I should have got from the start, and realised playgrounds were great tools for opportunistic hackery.

I finally got this once I found temporary Swift playgrounds and now you can't stop me. But that doesn't mean I don't remain wary.

You're really going out with him?

We've all got that crazy friend, former partner, occasional 'acquaintance' that we hang out with, but let's be honest, our parents are never going to meet. Or at least I hope not. You see, while I can accept that Swift playgrounds can play loose and fast, be a maverick and have that tattoo that says "live fast, die young and get saved to /dev/null" I can't but help think that some of it might one day infect something I love. Like real code.

There is no way in hell that colour literals should ever be allowed outside of playgrounds. They might be fun at a young age, but they are never going to be acceptable in polite society. Or at least not in polite colourblind society, of which I'm a member.

Here's how it works, you create a playground, you declare a variable and you select Editor -> Insert Color Literal. Hey presto, you have a colour directly in your code. 

Look, I get it, it's quick, it's a playground, it's kinda quirky. But for us colourblind folks we might as well now be dyslexic. And it's not easy being a dyslexic programmer! (Seriously, those folks have it way tougher than I could ever lay claim to. I feel guilty just writing this)

So here's my plea. Keep it in playgrounds. Don't ever make the mistake (like you did with freaking emojis) of thinking that you can put colours directly into your code in real projects. Ok, it isn't a reality just yet, but someone somewhere is going to ask for it. And it can't become a reality, it just can't. Reading other people's code is hard enough as it is without wondering if that colour is the one for the button, or that ever-so-slightly-different other colour for the highlighted button.

Today, colour literals, tomorrow... chartreuse.