The Sass REPL

A Hidden Gem

Happy new year! In this short episode, we’ll look into how we can use the Sass REPL to generate colors for GitHub labels.

I’ve been trying to incorporate Scrum story points into my GitHub project, so that I can plan the progress of project more effectively. I will use labels to assign points to issues.

Sometimes I’m obsessed about colors. I want to give these labels different colors, so that the color becomes darker as point increases. Here’s the end result I want.

At first, I tried using Mac OS X’s color picker and pick the color for each label, but the colors looked too arbitrary. They don’t fade proportionally to these point values.

The darken() and lighten() function found in Sass came to my mind — that’s just what I want! What’s the quickest way to make use of them? So I typed sass -h.

    -i, --interactive     Run an interactive SassScript shell

For me, it’s an amazing discovery to know that Sass actually has a REPL. So, sass -i.

>> $color: #F9D4C1
#f9d4c1
>> darken($color, 3%)
#f8cab3

Now, you can generate the colors for other labels by adjusting the percentage of darkness to apply to $color. You can also use math like 3%*2.

Now I have a beautiful-looking Waffle board with story points!

Image for post
Image for post

Code, Applied to Life

Stories about how coding can be applied to solve everyday…

Thai Pangsakulyanont

Written by

(@dtinth) A software engineer and frontend enthusiast. A Christian. A JavaScript musician. A Ruby and Vim lover.

Code, Applied to Life

Stories about how coding can be applied to solve everyday life problems. (Formerly Ruby Everyday).

Thai Pangsakulyanont

Written by

(@dtinth) A software engineer and frontend enthusiast. A Christian. A JavaScript musician. A Ruby and Vim lover.

Code, Applied to Life

Stories about how coding can be applied to solve everyday life problems. (Formerly Ruby Everyday).

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store