Skip to content

Instantly share code, notes, and snippets.

View lunatic-fox's full-sized avatar
📡

Josélio de S. C. Júnior lunatic-fox

📡
View GitHub Profile
@lunatic-fox
lunatic-fox / Colors on bash console.md
Last active May 10, 2023 03:03
Echo with colors on bash.

Colors on bash console

Usage

# Allowed color patterns.
color "#0F0"    "Line in \"lime\" color."
color "#dc143c" "Line in \"crimson\" color."

# Not allowed.
color "#dc14" "Not allowed pattern."
color "Text only."
@lunatic-fox
lunatic-fox / colors.kt
Created March 11, 2021 03:08
KOTLIN CONSOLE WITH COLORS
//Main constants and functions
const val RC = "\u001b[0m" // Reset foreground and background colors. --> $RC
const val R = "\u001b[7m" // Invert foreground to background. --> $R
const val U = "\u001b[4m" // Underline. --> $U
const val B = "\u001b[1m" // Bold. --> $B
const val I = "\u001b[3m" // Italic. --> $I
const val S = "\u001b[9m" // Strikethrough the text. --> $S
// 256 Colors
fun fg(n:Int) = "\u001b[38;5;${n}m" // Set a foreground color. --> ${fg(40)} //Sets a green color.