DEV Community

Cover image for Day 13: I love Boxes! šŸ“¦
Valeria
Valeria

Posted on

6 1 1

Day 13: I love Boxes! šŸ“¦

Who doesn't like boxes? Especially if there's something nice hidden in the box! Today we'll look at a tiny library that adds a box to any text: boxen.

As usual, install it with e.g. deno add npm:boxen and create a file, e.g. main.ts:

import boxen from "boxen";

console.log(boxen("Happy Holidays!", { padding: 1 }));
Enter fullscreen mode Exit fullscreen mode

And when you run it with deno run -A ./main.ts you should be able to see something like that:

There are some styling options you could apply, e.g. double or round borders and different color. Or, if you're up for it you could try and do something like that:

import boxen from "boxen";

console.log(
  boxen(
    boxen(
      boxen("Happy Holidays!", {
        padding: 1,
        borderStyle: "round",
        borderColor: "greenBright",
      }),
      {
        padding: 1,
        borderStyle: "round",
        borderColor: "yellowBright",
      }
    ),
    {
      padding: 1,
      borderStyle: "round",
      borderColor: "redBright",
    }
  )
);
Enter fullscreen mode Exit fullscreen mode

And get something like this:

Three colored borders around

Liked the content and would love to have more of it all year long?

Buy Me A Coffee

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (3)

Collapse
 
moopet profile image
Ben Sinclair ā€¢

This is a really fun little series.

Collapse
 
valeriavg profile image
Valeria ā€¢

Thank you so much! Glad you liked it!

Collapse
 
nozibul_islam_113b1d5334f profile image
Nozibul Islam ā€¢

Great.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

šŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay