DEV Community

Cover image for Day 2: Terminal Gradients 🌈
Valeria
Valeria

Posted on

Day 2: Terminal Gradients 🌈

I love how colourful and sparkly everything is during holiday season, dont you? And today I'll share with you a tool that makes terminal a lot more festive as well!

Install the dependency, e.g:

deno add npm:gradient-string
Enter fullscreen mode Exit fullscreen mode

Create a script, e.g. main.ts:

import gradient from "npm:gradient-string";
console.log(gradient(["red", "green"])("Happy Holidays"));
Enter fullscreen mode Exit fullscreen mode

And run with deno -A main.ts:

Red to green gradient saying

And if that didn't impress you, try this one:

import { pastel } from "npm:gradient-string";

console.log(
  pastel.multiline(
    `
          .     .  .      +     .      .          .
     .       .      .     #       .           .
        .      .         ###            .      .      .
      .      .   "#:. .:##"##:. .:#"  .      .
          .      . "####"###"####"  .
       .     "#:.    .:#"###"#:.    .:#"  .        .       .
  .             "#########"#########"        .        .
        .    "#:.  "####"###"####"  .:#"   .       .
     .     .  "#######""##"##""#######"                  .
                ."##"#####"#####"##"           .      .
    .   "#:. ...  .:##"###"###"##:.  ... .:#"     .
      .     "#######"##"#####"##"#######"      .     .
    .    .     "#####""#######""#####"    .      .
            .     "      000      "    .     .
       .         .   .   000     .        .       .
.. .. ..................O000O........................ ...... ...`
  )
);

Enter fullscreen mode Exit fullscreen mode

Now, that's sight to behold:

Colourful pastel ASCII tree

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

Buy Me A Coffee

Top comments (0)