Commits

Anonymous committed c6aaaab

make variables for colors in cw_color.sh so the user doesn't have to change the sed expressions

Comments (0)

Files changed (1)

extras/cw_color.sh

 bg_cyan="$(tput setab 6)"
 bg_white="$(tput setab 7)"
 
+date="$bold$black"
+serv="$bold$black"
+nick="$cyan"
+act="$magenta"
+me="$red"
+
 NICK="$USER"
 MARGIN='>|!'
 FIELD=2
 done
 
 # in order, do
-# change notice continuation lines: color the line blue
-# change notice lines: color blue
-# change CTCP ACTION lines: remove ACTION and MARGIN and color line magenta
-# change normal lines: color time blue, color nick cyan
-# change lines that are as of yet unmatched: color time blue
-# color nick red and add bell
+# change notice continuation lines: color $serv
+# change notice lines: color $serv
+# change CTCP ACTION lines: remove ACTION and MARGIN and color $act
+# change normal lines: color time $date, color nick $nick
+# change lines that are as of yet unmatched: color time $date
+# color nick $me and add bell
 
 cw -i "$IN" -o "$OUT" -m "$MARGIN" -d "$DELIM" -f "$FIELD" |
 	sed \
-		-e "s/^\( *!.*\)$/${blue}\1${reset}/" \
-		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *-!-.*\)$/${blue}\1\2\3${reset}/" \
-		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\) ACTION\(.*\)$/${blue}\1\2${reset}\3${cyan}${magenta}\4\6${reset}/" \
-		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\)/${blue}\1\2${reset}\3${cyan}\4${reset}\5/" \
-		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?/${blue}\1\2${reset}/" \
-		-e "s/$NICK/\a${red}&${reset}/g"
+		-e "s/^\( *!.*\)$/${serv}\1${reset}/" \
+		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *-!-.*\)$/${date}\1\2\3${reset}/" \
+		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\) ACTION\(.*\)$/${date}\1\2${reset}\3${act}\4\6${reset}/" \
+		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?\( *<\?\)\( *[^ $MARGIN]*\)\( \?[$MARGIN]\)/${date}\1\2${reset}\3${nick}\4${reset}\5/" \
+		-e "s/^\([-0-9]\{10\} \)\?\([:0-9]\{5\}\)\?/${date}\1\2${reset}/" \
+		-e "s/$NICK/\a${reset}${me}&${reset}/g"
 
 # vim: set ts=4 sw=4 noexpandtab: