WeeklyRandom #2: lukeed/kleur

Nikolas
Nikolas
Nov 21, 2018 · 2 min read

Welcome to WeeklyRandom, a blog series in which I challenge myself to explore a random GitHub repository starred by me (almost) every week.

Let’s find out which repo I can explore this time.

🥁

node index.js vintagesucks 
https://github.com/lukeed/kleur

kleur by Luke Edwards. The description of the repo is as follows:

The fastest Node.js library for formatting terminal text with ANSI colors~!

Nice. Let’s try to add some color to random-starred-repository, my Node.js script that powers the repository selection for WeeklyRandom. This should be done rather quickly, but could improve readability a lot.

This is how my output line looks right now:

// index.js
console.log("https://github.com/" + result[randomEntry].owner + "/" + result[randomEntry].repo)
This is how it looks

Let’s try kleur.


npm install --save kleur// index.js 
+ const { green } = require('kleur');
- console.log("https://github.com/" + result[randomEntry].owner + "/" + result[randomEntry].repo)
+ console.log(green().bold(
+ "https://github.com/" + result[randomEntry].owner + "/" + result[randomEntry].repo
+ ))
This is how it looks now 🎉

You can find the complete code on GitHub at vintagesucks/random-starred-repository. Pull requests with improvements are very welcome!

Until next time, when I’ll check out my next WeeklyRandom repository.


Originally published at nikol.as on November 21, 2018.

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