DEV Community

Nikolas Evers
Nikolas Evers

Posted on • Originally published at nikol.as on

1 2

WeeklyRandom #2: lukeed/kleur

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:

random-starred-repository without kleur

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:

random-starred-repository with kleur

🎉

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.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️