DEV Community

Cover image for Of Course I Need Fun Routes! 🌈
Anna Villarreal
Anna Villarreal

Posted on

Of Course I Need Fun Routes! 🌈

*general excitement*


Another one of my little tangent side quests here. I'll admit I had to do a little digging to figure this one out. It has no real purpose other than it's awesome and I had fun doing it. You may like it too.

When you run rails routes, you get a swath of white text in your terminal that isn't all that fun to look at. Additionally, it often will run on to the next line and it's a little haphazard feeling unless you zoom way out and then make your terminal gigantic. Can't have that. It has to be fun. (Or you know, stylized to your taste, 10 shades of whatever your brand is.) XD

Turn this:

regular routes

Into this:

fun routes

So I messed around a bit...

colored lines

Ok, things are happening. You can easily add structure by calling rails routes --expanded

expanded rainbow routes

Now were cooking with fire.

If this can be done, it means I can break it apart and put colors in places I want them. Excellent.

Lets take one part of the route, lets say the path for example. We can make a color array to loop over the characters.

rainbow paths

This is totally my vibe.


But can it be useful?

How about we highlight the verbs and slap the controller below it so it's not so squished in the terminal.

excellent routes

Now we can find the routes a bit easier with verb highlighting. Perf.

The point here is, you can tweak it, and it can be sort of helpful.

If you are interested in poking around with this, my rake file can be found here: Rainbow Routes

Thanks for looking!

I'd like to hear everyones 2 cents on the matter. Does anyone else do this? 🤣

Top comments (2)

Collapse
 
bibimbop123 profile image
Brian Kim

Not gonna lie I did find that pretty cool! Thanks for sharing Anna!

Collapse
 
annavi11arrea1 profile image
Anna Villarreal

Thanks!