coloring update

This commit is contained in:
ville rantanen
2015-06-15 10:48:23 +03:00
parent 0b10b22c32
commit 3516fed53c
2 changed files with 37 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ Example rules: ( ~/.highbeamrc )
--------------------
RULES=(
"[0-9]" "$c" # Show numbers with Cyan color. NOTE: since the colors are represented with numbers, having this later in the rules will break coloring!
"$USER[ ]\+$USER" "$BGC$BLACK" # Use quotes to have rules with spaces. This colors the "ls -la" usernames. background cyan, black text
"$USER[ ]\+$USER" "$BC$K" # Use quotes to have rules with spaces. This colors the "ls -la" usernames. background cyan, black text
status "$g" # simple word matching, coloring green
"^d[^ ]*" "$G" # color words at the beginning of line, starting with d. color bright green
"q.\{0,3\}r" "$Y" # q*r with maximum 3 characters in between. color bright yellow
@@ -23,6 +23,7 @@ Bright colors: $R $G $B $Y $M $C $W $K
Dark colors: $r $g $b $y $m $c $w $k
Modify to bright version by prefixing with $H (e.g. $H$g)
Background colors: $BR $BG $BB $BY $BC $BM $BW
Underline: $U
Usage: highbeam [-c] [-h] [-f config]
-c Be case sensitive
@@ -56,7 +57,6 @@ m="${E}35m"
c="${E}36m"
w="${E}37m"
# list of BG colors:
BR="${E}41m"
BG="${E}42m"
@@ -66,6 +66,9 @@ BM="${E}45m"
BC="${E}46m"
BW="${E}47m"
# lines
U="${E}4m"
CONF_FILE=~/.highbeamrc
CONF_LINE=""

View File

@@ -8,25 +8,44 @@ function helpexit() {
[[ -z "$1" ]] && helpexit
[[ "$1" = "-h" ]] && helpexit
export HB_RULES='"^\s*\*.*" "$y" \
"^[[:space:]]*[0-9]\+\..*" "$y" \
"^#.*" "$W" \
"^\s\s\s\s[^\*0-9].*" "$c" \
"\`[^[[:space:]]]*[^\`]\+\`" "$c" \
"\[[^]]\+\]([^)]\+)" "$B" \
"\*[^[[:space:]]]*[^\*]\+\*" "$H" \
"_[^[[:space:]]]*[^\_]\+_" "$H" \
"<[^>]\+>" "$K" \
'
# * bullets
# 1. ordered list
# ## Headers
# code block
# code inline
# [links](URL)
# *bold*
# *bold* & **bold**
# _bold_
# <> tags
cat "$@" | highbeam
# Color codes
export HB_RULES='"^\s*\*.*" "$y" \
"^[[:space:]]*[0-9]\+\..*" "$y" \
"^#.*" "$U$W" \
"^\s\s\s\s[^\*0-9].*" "$c" \
"\`[^[[:space:]]]*[^\`]\+\`" "$c" \
"\[[^]]\+\]([^)]\+)" "$B$U" \
"\*\{1,2\}[^[[:space:]]]*[^\*]\+\*\{1,2\}" "$W" \
"_[^[[:space:]]]*[^_]\+_" "$W" \
"<[^>]\+>" "$K" \
"\${R}.*" "$R" \
"\${G}.*" "$G" \
"\${B}.*" "$B" \
"\${C}.*" "$C" \
"\${M}.*" "$M" \
"\${Y}.*" "$Y" \
"\${r}.*" "$r" \
"\${g}.*" "$g" \
"\${b}.*" "$b" \
"\${c}.*" "$c" \
"\${m}.*" "$m" \
"\${y}.*" "$y" \
"\${k}.*" "$k" \
"\${K}.*" "$K" \
"\${w}.*" "$w" \
"\${W}.*" "$W" \
"\${U}.*" "$U" \
'
cat "$@" | highbeam | sed 's,\${[RGBCMYrgbcmykKwWU]},,g'