[!TIP] Highlight was designed to offer a flexible but easy to use syntax highlighter for several output formats. Instead of hardcoding syntax or colouring information, all relevant data is stored in configuration scripts. These scripts may be altered or enhanced with plug-in scripts.
# colorcat# - cats a file, but if any line contains N hex colors, it appends the colors# (rendered as ansi escape sequences) to the end of the line.# - input can be stdin, a file, or a hex color in plain textfunctioncolorcat() {if [[ "$#"-eq1&&!-f"$1" ]]; thenecho"$1"elsecat"$@"fi|whileread-rline; dolocal colors=""for word in $line; doif [[ "$word"=~ ^[^A-Fa-f0-9]*#?([A-Fa-f0-9]{6})[^A-Fa-f0-9]*$ ]]; then hex=${BASH_REMATCH[1]}local r=$((16#${hex:0:2}))local g=$((16#${hex:2:2}))local b=$((16#${hex:4:2}))local truecolor="\033[48;2;${r};${g};${b}m"local reset="\033[0m" colors="${colors}${truecolor} ${reset} "fidoneecho-e"$line $colors"done}