Bringing more colour to Android Studio
Sometimes coding can be a bit frustrating — why is this build taking so long? Why is it crashing? What is happening? While I won’t answer those questions right now, there’s a few tips that can make it more bearable and easier to deal with — with colour.
First up: Slow builds. Frustrated by waiting for your gradle build to finally finish? Make things more colourful! Go to the Android Studio preferences, search for plugins, click browse repositories and search for “Nyan Progress Bar”. Install, restart Android Studio and your progress bar will look like this:
Who doesn’t know a bit of Nyan Cat? Sadly (or maybe luckily) it doesn’t play the song while building. Your builds won’t actually be faster, but they’ll be more fun to watch.
But that’s not all the Nyan Cat love you can get. You might remember the logcat icon in Android Studio pre-3.0 — nyandroid. Sadly they took it away in 3.0 and replaced it with this icon:
Not only is this not very exciting — it makes it actually harder for me to find. The number 6 here is a hint to be able to access it via a different way and that is the keyboard shortcut cmd + 6
on Mac or alt + 6
on Windows/Linux.
That is great, but still — I miss nyandroid. The good news is I’m not the only one that missed it and somebody created the Nyandroid Restorer plugin. So let’s just install that and take another look:
Nyandroid is back! Opening logcat to figure out an issue is much more fun. But logcat itself is still quite boring to look at. Sure — errors are red and warnings are blue, but there’s still a lot of black text, which makes it hard to parse. Can’t we make it a bit more colourful? The answer is yes!
In the preferences open Editor — Android Logcat and start customising your output. Maybe errors should be very bold and jump out, maybe you just want a rainbow. You have many possibilities. Just uncheck the “Inherit values from:” box and you can go wild.
These are the colours I ended up with (yes, I’m using the light theme):
Assert: #A800FF
Debug: #027AB4
Error: #FF0000 (bold)
Info: #003CC8
Verbose: #646464
Warning: #FA8800
That is great, but there’s a few more little gems hidden. You might’ve already noticed that there’s a few more things to change, apart from the foreground. Maybe you want to have a background instead of actually changing the font colours? Or maybe just add a border around the different log levels to easily group them together.
But the most useful setting for me is the error strip mark. You may already know this from the Android Studio editor. Have you seen those little markers on the scrollbar? They indicate errors, warnings, search results and many more and let you jump to them quickly. You can also enable them for logcat. Want to know where the crash is? Just set an error strip mark for errors.
Now let’s compare this to the default setting:
The modified version is a lot more colourful! It makes it a lot easier to parse the logs for me and also makes it more fun to look at.
But why stop at logcat? You can actually modify the colour scheme for the whole editor. Just like you can choose between Darcula and Default there’s actually many, many more colour schemes out there, or you can even create your own. Somebody created a website collecting them all — if you’re bored of the default colour scheme, check it out.
But colours aren’t the only thing you can customise — you can also change the editor font. There’s a ton of great monospace fonts out there, choosing the right one for you might take a while, but I found this article very useful (even if it’s quite old). Just install a font and select it in Preferences — Editor — Font.
These are just a few things you can do — there’s a ton of other things you can customise. What’s your favourite setting, colour scheme or font?
Thanks to Corey for showing Ben the logcat colour setting, Ben for showing it to the Deliveroo Android team, Amal for finding the error strip mark and Moj for planting the seeds for a blog post.