{"thread":{"id":"879","subject":"[PATCH 2/6] Factor out color settings to cg-Xlib","startedAt":"2005-06-09T11:17:00Z","lastAt":"2005-06-09T11:17:00Z","messageCount":1,"participants":["Dan Holmsand"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"4778","messageId":"42A8252C.8040805@gmail.com","threadId":"879","inReplyTo":null,"subject":"[PATCH 2/6] Factor out color settings to cg-Xlib","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-09T11:17:00Z","receivedAt":"2005-06-09T11:17:00Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"[PATCH 2/6] Factor out color settings to cg-Xlib\n\nsetup_colors sets color variables from COGITO_COLORS, and\nadds a sed script for diff colorization to color_rules.\n\nNote that this changes the default colors a little from the\nones in cg-diff: in particular there's no bold any more. Bold\nisn't really necessary if the \"less search\" thing in the new\ncg-diff/cg-log is used (and bold is really ugly in\ngnome-terminal :-) ).\n\nSigned-off-by: Dan Holmsand <holmsand@gmail.com>\n---\n\n\n\n cg-Xlib |   23 +++++++++++++++++++++++\n 1 files changed, 23 insertions(+), 0 deletions(-)\n\ndiff --git a/cg-Xlib b/cg-Xlib\n--- a/cg-Xlib\n+++ b/cg-Xlib\n@@ -136,6 +136,29 @@ print_help () {\n \texit\n }\n \n+setup_colors() {\n+\tlocal C=\"header=32:author=36:signoff=33:committer=35:files=34\"\n+\tC=\"$C:commit=34:date=32:trim=35\"\n+\tC=\"$C:diffhdr=34:diffhdradd=32:diffadd=32:diffhdrmod=35\"\n+\tC=\"$C:diffmod=35:diffhdrrem=31:diffrem=31:diffhunk=36\"\n+\tC=\"$C:diffctx=34:diffcctx=33:default=0\"\n+\t[ -n \"$COGITO_COLORS\" ] && C=\"$C:$COGITO_COLORS\"\n+\n+\tC=${C//=/=\\'$'\\e'[}\n+\tC=col${C//:/m\\'; col}m\\'\n+\t#coldefault=$(tput op)\n+\teval $C\n+\n+\tcolor_rules=\"\n+s,^+++.*,$coldiffhdradd&$coldefault,\n+s,^---.*,$coldiffhdrrem&$coldefault,\n+s,^[+].*,$coldiffadd&$coldefault,\n+s,^[-].*,$coldiffrem&$coldefault,\n+s,^\\\\(@@.*@@\\\\)\\\\(.*\\\\),$coldiffhunk\\\\1$coldiffctx\\\\2$coldefault,\n+s,^=*$',$coldiffhdr&$coldefault,\n+s,^\\\\(Index:\\\\|===\\\\|diff\\\\) .*,$coldiffhdr&$coldefault,\"\n+}\n+\n for option in \"$@\"; do\n \tif [ \"$option\" = \"-h\" -o \"$option\" = \"--help\" ]; then\n \t\tprint_help ${_cg_cmd##cg-}\n"}]}