Skip to content

MattyRad/quick-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4c5347b · Apr 16, 2024

History

13 Commits
Jan 22, 2024
Apr 16, 2024
Aug 9, 2023
Aug 8, 2023
Jan 22, 2024
Aug 9, 2023
Aug 9, 2023
Aug 9, 2023
Aug 9, 2023
Aug 9, 2023

Repository files navigation

quick-color

Color terminal output from stdout. That is all.

echo "hello world" | quick-color '#0a0'

I had a hard time finding a binary that does this. Someone point it out if it exists.

The main goal is to produce colored terminal output for tailing log levels in a way that doesn't use hard-to-understand escape sequences.

Installation

See releases.

Examples

#!/usr/bin/env zsh

tail ${@:1} > /dev/null | tee \
	>(grep --line-buffered DEBUG | quick-color '#333') \
	>(grep --line-buffered INFO | quick-color '#888') \
	>(grep --line-buffered NOTICE | quick-color '#fff') \
	>(grep --line-buffered WARNING | quick-color '#fccb00') \
	>(grep --line-buffered ERROR | quick-color '#ff6900') \
	>(grep --line-buffered CRITICAL | quick-color --bold '#ff6900') \
	>(grep --line-buffered ALERT | quick-color '#f44336') \
	>(grep --line-buffered EMERGENCY | quick-color --bold '#f44336') \
	> /dev/null
#!/usr/bin/env bash

tail ${@:1} | tee \
	>(grep --line-buffered DEBUG | quick-color '#333') \
	>(grep --line-buffered INFO | quick-color '#888') \
	>(grep --line-buffered NOTICE | quick-color '#fff') \
	>(grep --line-buffered WARNING | quick-color '#fccb00') \
	>(grep --line-buffered ERROR | quick-color '#ff6900') \
	>(grep --line-buffered CRITICAL | quick-color --bold '#ff6900') \
	>(grep --line-buffered ALERT | quick-color '#f44336') \
	>(grep --line-buffered EMERGENCY | quick-color --bold '#f44336') \
	> /dev/null