From 78830c1f472a0a1a4d3edb1018cce5c6c22fb6a0 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 30 Apr 2011 18:35:54 +0000 Subject: [PATCH] fixed color schemes to only show safe dark/light group for irc or global color picker. This solves the problem of unreadable output for some irc viewers Also added output to color picker to show what selection was. Note: I changed some of the colors so the old selections won't be the same, so please update version package maintainers --- inxi | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/inxi b/inxi index e783476..0951faa 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.91 +#### version: 1.4.92 #### Date: April 30 2011 ######################################################################## #### SPECIAL THANKS @@ -395,20 +395,23 @@ A_COLORS_AVAILABLE=( DGREY BLACK RED DRED GREEN DGREEN YELLOW DYELLOW BLUE DBLUE # See above for notes on EMPTY ## note: group 1: 0, 1 are null/normal ## Following: group 2: generic, light/dark or dark/light; group 3: dark on light; group 4 light on dark; +# this is the count of the first two groups, starting at zero +SAFE_COLOR_COUNT=12 A_COLOR_SCHEMES=( EMPTY,EMPTY,EMPTY NORMAL,NORMAL,NORMAL BLUE,NORMAL,NORMAL +BLUE,RED,NORMAL +CYAN,BLUE,NORMAL DCYAN,NORMAL,NORMAL +DCYAN,BLUE,NORMAL +DGREEN,NORMAL,NORMAL +DYELLOW,NORMAL,NORMAL +GREEN,DGREEN,NORMAL +GREEN,NORMAL,NORMAL MAGENTA,NORMAL,NORMAL RED,NORMAL,NORMAL -DGREEN,NORMAL,NORMAL -GREEN,DGREEN,NORMAL -DYELLOW,NORMAL,NORMAL -DCYAN,BLUE,NORMAL -DCYAN,RED,NORMAL -BLUE,NORMAL,NORMAL BLACK,DGREY,NORMAL DBLUE,DGREY,NORMAL @@ -844,7 +847,28 @@ select_default_color_scheme() eval $LOGFS local spacer=' ' options='' user_selection='' config_variable='' local config_file="$HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf" - local irc_clear="" + local irc_clear="" + local irc_gui='Unset' irc_console='Unset' irc_x_term='Unset' + local console='Unset' virt_term='Unset' global='Unset' + + if [[ -n $IRC_COLOR_SCHEME ]];then + irc_gui="Set: $IRC_COLOR_SCHEME" + fi + if [[ -n $IRC_CONS_COLOR_SCHEME ]];then + irc_console="Set: $IRC_CONS_COLOR_SCHEME" + fi + if [[ -n $IRC_X_TERM_COLOR_SCHEME ]];then + irc_x_term="Set: $IRC_X_TERM_COLOR_SCHEME" + fi + if [[ -n $VIRT_TERM_COLOR_SCHEME ]];then + virt_term="Set: $VIRT_TERM_COLOR_SCHEME" + fi + if [[ -n $CONSOLE_COLOR_SCHEME ]];then + console="Set: $CONSOLE_COLOR_SCHEME" + fi + if [[ -n $GLOBAL_COLOR_SCHEME ]];then + global="Set: $GLOBAL_COLOR_SCHEME" + fi # don't want these printing in irc since they show literally if [[ $B_RUNNING_IN_SHELL != 'true' ]];then @@ -869,6 +893,14 @@ select_default_color_scheme() if [[ $i -gt 9 ]];then spacer=' ' fi + # only offer the safe universal defaults + case $COLOR_SELECTION in + global|irc|irc-console|irc-virtual-terminal) + if [[ $i -gt $SAFE_COLOR_COUNT ]];then + break + fi + ;; + esac set_color_scheme $i print_screen_output "$irc_clear $i)$spacer${C1}Card:${C2} nVidia G86 [GeForce 8400 GS] ${C1}X.Org${C2} 1.7.7" done @@ -882,7 +914,8 @@ select_default_color_scheme() print_screen_output "------------------------------------------------------------------------------" print_screen_output "Simply type the number for the color scheme that looks best to your eyes for your $COLOR_SELECTION settings" print_screen_output "and hit ENTER. NOTE: You can bring this option list up by starting $SCRIPT_NAME with option: -c plus one of these numbers:" - print_screen_output "94 (console, no X); 95 (terminal, X); 96 (irc, X); 97 (irc, X, in terminal); 98 (irc, no X); 99 (global)." + print_screen_output "94 (console, no X - $console); 95 (terminal, X - $virt_term); 96 (irc, gui, X - $irc_gui);" + print_screen_output "97 (irc, X, in terminal - $irc_x_term); 98 (irc, no X - $irc_console); 99 (global - $global)" print_screen_output "Your selection(s) will be stored here: $config_file" print_screen_output "Global overrides all individual color schemes. Individual schemes remove the global setting." print_screen_output "------------------------------------------------------------------------------" @@ -960,7 +993,8 @@ select_default_color_scheme() print_screen_output "------------------------------------------------------------------------------" print_screen_output "After finding the scheme number you like, simply run this again in a terminal to set the configuration" print_screen_output "data file for your irc client. You can set color schemes for the following: start inxi with -c plus:" - print_screen_output "94 (console, no X); 95 (terminal, X); 96 (irc, X); 97 (irc, X, in terminal); 98 (irc, no X); 99 (global) - like: $SCRIPT_NAME -c 97" + print_screen_output "94 (console, no X - $console); 95 (terminal, X - $virt_term); 96 (irc, gui, X - $irc_gui);" + print_screen_output "97 (irc, X, in terminal - $irc_x_term); 98 (irc, no X - $irc_console); 99 (global - $global)" exit 0 fi