fast ansi color tagging lib, inspired by blessed from node
Find a file
2026-01-05 23:40:03 -05:00
colors.go cleanup: drop fatih/color in favor of reinventing the wheel 2025-12-20 14:57:24 -05:00
funcs.go chore: color stack logic cleanup 2026-01-05 23:40:03 -05:00
funcs_test.go chore: docccccccz 2026-01-05 13:13:09 -05:00
go.mod forge switch 2026-01-03 21:52:25 -05:00
LICENSE initial commit 2025-08-01 16:51:19 -04:00
README.MD chore: docccccccz 2026-01-05 13:13:09 -05:00

oigiki

Go Reference

fast ansi color tagging lib, inspired by blessed from node
extracted from axefetch and improved
minimum go version: 1.10

features

  • NO_COLOR support
  • FORCE_COLOR support (takes precedence over NO_COLOR)
  • CLICOLOR_FORCE support (takes precedence over NO_COLOR)
  • all 16 colors (normal + bright)
  • 256color (as index, 0-255)
  • truecolor (as rrrggbb hex)

import

go get git.0xf0xx0.eth.limo/0xf0xx0/oigiki

usage

/// coloring will run until overridden
/// chaining works too uwu
oigiki.ProcessTags("{red}red{green}green{/green}red") /// -> "\x1b[31mred\x1b[32mgreen\x1b[31mred\x1b[0m"
/// unknown tags are ignored
oigiki.ProcessTags("{red}red {totallyrealcolor}still red") /// -> "\x1b[31mred {totallyrealcolor}still red\x1b[0m"

oigiki.TagString("this should be red", "red") /// -> "{red}this should be red"
oigiki.StripTags("{red}{bold}whos that {bg#f100f1}{underline}knockin{/underline} at my door?") /// -> whos that knockin at my door?

256color

"{bg0}{7}yin{bg7}{0}yang" /// -> "\x1b[48;5;0m\x1b[38;5;7myin\x1b[48;5;7m\x1b[38;5;0myang\x1b[0m"

truecolor

/// hex must be the full rrggbb
"{bg#d60270}{#0038a8}po{/}{#9b4f96}go{bg#0038a8}{#d60270}lo{/}!" /// -> "\x1b[48;2;214;2;112m\x1b[38;2;0;56;168mpo\x1b[0m\x1b[38;2;155;79;150mgo\x1b[48;2;0;56;168m\x1b[38;2;214;2;112mlo\x1b[0m!\x1b[0m"