COLORSET(3)

📦
version 0.9.11 · 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

💖 NAME 💖

colors — the libbash library for setting tty colors, bestie 🌈

okay so real talk, this page is from the UNTITLED() slot in the LOCAL manual, and it's giving "small library, huge personality". no cap. 💅

✨ SYNOPSIS ✨

colorSet     ⟨color⟩
colorReset
colorPrint   [⟨indent⟩] ⟨color⟩ ⟨text⟩
colorPrintN  [⟨indent⟩] ⟨color⟩ ⟨text⟩

🎀 DESCRIPTION 🎀

🌸 General 🌸

colors is literally a whole collection of functions whose entire job is making it super easy to put colored text on a tty. that's it. that's the vibe. 🦋

here's the function lineup, bestie:

  • colorSet — sets the color of the prints to the tty to COLOR ✨
  • colorReset — resets current tty color back to normal 🫶
  • colorPrint — prints TEXT in the color COLOR indented by INDENT (and without adding a newline)
  • colorPrintN — the same as colorPrint, but a trailing newline is added 👑

the detailed interface description follows, keep scrolling, it's worth it 💜

🌈 Available colors: 🌈

  • Green
  • Red
  • Yellow
  • White

the color parameter is non-case-sensitive — like, RED, red, ReD, and literally all the other forms are valid and are the same as Red. it does not care about your shift key, periodt. 💅


👑 FUNCTIONS DESCRIPTIONS 👑

⭐ colorSet ⟨color⟩

sets the current printing color to color.

⭐ colorReset

resets current tty color back to normal. we love a clean slate 🌸

⭐ colorPrint [⟨indent⟩] ⟨color⟩

prints text using the color color indented by indent (without adding a newline).

parameters:

  • ⟨indent⟩ the column to move to before start printing. this parameter is optional — if ommitted, start output from current cursor position. 🙈
  • ⟨color⟩ the color to use.
  • ⟨color⟩ the text to print.
okay yes, the page really does list ⟨color⟩ twice up there and the second one is the text. not me editing the source material — we report the lore exactly as it was written. 😭

⭐ colorPrintN [⟨indent⟩] ⟨color⟩

the same as colorPrint, except a trailing newline is added. tiny difference, big energy ✨


🧚 EXAMPLES 🧚

printing a green 'Hello World' with a newline:

using colorSet:

$ colorSet green
$ echo 'Hello World'
$ colorReset

using colorPrint:

$ colorPrint 'Hello World'; echo

using colorPrintN:

$ colorPrintN 'Hello World'

slay. go forth and be colorful 🎀


💜 AUTHORS 💜

  • Hai Zaar <haizaar@haizaar.com>
  • Gil Ran <gil@ran4.net>

icons, both of them 👑


🦋 SEE ALSO 🦋

ldbash(1), libbash(1)


okay bestie that's the whole page 🫶 this was the COLORS(3) manual page, living in the Linux source/version corner of the world, and the date on it? UNDATED — timeless, honestly, main character energy, it simply never expires 💖✨🎀

📦 where this page comes from