[arch-projects] [INITSCRIPTS][PATCH 1/2] Fix coloring on light terms
Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- functions | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions b/functions index fd0928e..6594fd2 100644 --- a/functions +++ b/functions @@ -51,20 +51,20 @@ fi # colors: if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then - C_MAIN="\033[1;37;40m" # main text + C_MAIN="\033[0;1m" # main text - C_OTHER="\033[1;34;40m" # prefix & brackets - C_SEPARATOR="\033[1;30;40m" # separator + C_OTHER="\033[1;34m" # prefix & brackets + C_SEPARATOR="\033[1;30m" # separator - C_BUSY="\033[0;36;40m" # busy - C_FAIL="\033[1;31;40m" # failed - C_DONE="\033[1;37;40m" # completed - C_BKGD="\033[1;35;40m" # backgrounded + C_BUSY="\033[0;36m" # busy + C_FAIL="\033[1;31m" # failed + C_DONE="\033[0;1m" # completed + C_BKGD="\033[1;35m" # backgrounded - C_H1="\033[1;37;40m" # highlight text 1 - C_H2="\033[1;36;40m" # highlight text 2 + C_H1="\033[0;1m" # highlight text 1 + C_H2="\033[1;36m" # highlight text 2 - C_CLEAR="\033[1;0m" + C_CLEAR="\033[0m" fi if [[ -t 1 ]]; then -- Sebastien "Seblu" Luttringer
This patch doesn't change nothing in functionnality. It remplace a magic number in code by a defined letter to escaping. Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- functions | 28 ++++++++++++++-------------- rc.sysinit | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/functions b/functions index 6594fd2..27fcb03 100644 --- a/functions +++ b/functions @@ -51,26 +51,26 @@ fi # colors: if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then - C_MAIN="\033[0;1m" # main text + C_MAIN="\e[0;1m" # main text - C_OTHER="\033[1;34m" # prefix & brackets - C_SEPARATOR="\033[1;30m" # separator + C_OTHER="\e[1;34m" # prefix & brackets + C_SEPARATOR="\e[1;30m" # separator - C_BUSY="\033[0;36m" # busy - C_FAIL="\033[1;31m" # failed - C_DONE="\033[0;1m" # completed - C_BKGD="\033[1;35m" # backgrounded + C_BUSY="\e[0;36m" # busy + C_FAIL="\e[1;31m" # failed + C_DONE="\e[0;1m" # completed + C_BKGD="\e[1;35m" # backgrounded - C_H1="\033[0;1m" # highlight text 1 - C_H2="\033[1;36m" # highlight text 2 + C_H1="\e[0;1m" # highlight text 1 + C_H2="\e[1;36m" # highlight text 2 - C_CLEAR="\033[0m" + C_CLEAR="\e[0m" fi if [[ -t 1 ]]; then - SAVE_POSITION="\033[s" - RESTORE_POSITION="\033[u" - DEL_TEXT="\033[$(($STAT_COL+4))G" + SAVE_POSITION="\e[s" + RESTORE_POSITION="\e[u" + DEL_TEXT="\e[$(($STAT_COL+4))G" else SAVE_POSITION="" RESTORE_POSITION="" @@ -360,7 +360,7 @@ set_consolefont() { stat_fail elif [[ $CONSOLEMAP ]]; then cat <<"EOF" >>/etc/profile.d/locale.sh -if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi +if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e(K"; fi EOF stat_done else diff --git a/rc.sysinit b/rc.sysinit index dc4be58..7b2cdfe 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -352,7 +352,7 @@ if [[ ${LOCALE,,} =~ utf ]]; then # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8. for i in /dev/tty[0-9]*; do /usr/bin/kbd_mode -u < ${i} - printf "\033%%G" > ${i} + printf "\e%%G" > ${i} done echo 1 > /sys/module/vt/parameters/default_utf8 stat_done @@ -362,7 +362,7 @@ else # make non-UTF-8 consoles work on 2.6.24 and newer kernels for i in /dev/tty[0-9]*; do /usr/bin/kbd_mode -a < ${i} - printf "\033%%@" > ${i} + printf "\e%%@" > ${i} done echo 0 > /sys/module/vt/parameters/default_utf8 stat_done -- Sebastien "Seblu" Luttringer
Could you explain a bit what this does? In particular, what was the meaning of the old codes and what is the meaning of the new ones? I assume this will still print something no matter what the color scheme? And in addition it will look good on non-black backgrounds? -t On Wed, May 4, 2011 at 1:18 AM, Sebastien Luttringer <seblu@seblu.net> wrote:
Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- functions | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/functions b/functions index fd0928e..6594fd2 100644 --- a/functions +++ b/functions @@ -51,20 +51,20 @@ fi
# colors: if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then - C_MAIN="\033[1;37;40m" # main text + C_MAIN="\033[0;1m" # main text
- C_OTHER="\033[1;34;40m" # prefix & brackets - C_SEPARATOR="\033[1;30;40m" # separator + C_OTHER="\033[1;34m" # prefix & brackets + C_SEPARATOR="\033[1;30m" # separator
- C_BUSY="\033[0;36;40m" # busy - C_FAIL="\033[1;31;40m" # failed - C_DONE="\033[1;37;40m" # completed - C_BKGD="\033[1;35;40m" # backgrounded + C_BUSY="\033[0;36m" # busy + C_FAIL="\033[1;31m" # failed + C_DONE="\033[0;1m" # completed + C_BKGD="\033[1;35m" # backgrounded
- C_H1="\033[1;37;40m" # highlight text 1 - C_H2="\033[1;36;40m" # highlight text 2 + C_H1="\033[0;1m" # highlight text 1 + C_H2="\033[1;36m" # highlight text 2
- C_CLEAR="\033[1;0m" + C_CLEAR="\033[0m" fi
if [[ -t 1 ]]; then -- Sebastien "Seblu" Luttringer
On Wed, May 4, 2011 at 1:40 AM, Tom Gundersen <teg@jklm.no> wrote:
Could you explain a bit what this does? In particular, what was the meaning of the old codes and what is the meaning of the new ones? Old ones set foreground color and background color always to black New ones doesn't set background colors and in case of white colors, just assume it's the default one.
I assume this will still print something no matter what the color scheme? And in addition it will look good on non-black backgrounds?
Ya. I've tested on linux / urxvt / roxterm / xterm with white color. Maybe a test with konsole and its exotic coloring may be useful.
-t
On Wed, May 4, 2011 at 1:18 AM, Sebastien Luttringer <seblu@seblu.net> wrote:
Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- functions | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/functions b/functions index fd0928e..6594fd2 100644 --- a/functions +++ b/functions @@ -51,20 +51,20 @@ fi
# colors: if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then - C_MAIN="\033[1;37;40m" # main text + C_MAIN="\033[0;1m" # main text
- C_OTHER="\033[1;34;40m" # prefix & brackets - C_SEPARATOR="\033[1;30;40m" # separator + C_OTHER="\033[1;34m" # prefix & brackets + C_SEPARATOR="\033[1;30m" # separator
- C_BUSY="\033[0;36;40m" # busy - C_FAIL="\033[1;31;40m" # failed - C_DONE="\033[1;37;40m" # completed - C_BKGD="\033[1;35;40m" # backgrounded + C_BUSY="\033[0;36m" # busy + C_FAIL="\033[1;31m" # failed + C_DONE="\033[0;1m" # completed + C_BKGD="\033[1;35m" # backgrounded
- C_H1="\033[1;37;40m" # highlight text 1 - C_H2="\033[1;36;40m" # highlight text 2 + C_H1="\033[0;1m" # highlight text 1 + C_H2="\033[1;36m" # highlight text 2
- C_CLEAR="\033[1;0m" + C_CLEAR="\033[0m" fi
if [[ -t 1 ]]; then -- Sebastien "Seblu" Luttringer
-- Sébastien Luttringer www.seblu.net
This patch has one flaw with $C_H2 (patch is available in a mail sent by me a while ago). This one does not look very nice with a white xfce4 terminal and gnome-terminal (with Linux colors). It's cyan. For testing, I have a white xfce4 terminal with linux colors. The attachment shows how cyan looks on a terminal like this. Other colors seem to be fine.
Maybe a test with konsole and its exotic coloring may be useful.
Konsole's white and black color schemes are exactly the same as gnome-terminal's linux console colors and xfce4 terminal's default ones. Flaws described above. -- Cheers, -- Kwpolska (http://kwpolska.co.cc) O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
On Sat, May 7, 2011 at 11:55 AM, Kwpolska <kwpolska@gmail.com> wrote:
This patch has one flaw with $C_H2 (patch is available in a mail sent by me a while ago). This one does not look very nice with a white xfce4 terminal and gnome-terminal (with Linux colors). It's cyan. For testing, I have a white xfce4 terminal with linux colors. The attachment shows how cyan looks on a terminal like this. Other colors seem to be fine.
Maybe a test with konsole and its exotic coloring may be useful.
Konsole's white and black color schemes are exactly the same as gnome-terminal's linux console colors and xfce4 terminal's default ones. Flaws described above.
Tkanks for testing and screenshot. Changing $C_H2 from cyan to another color is more than patching bad displaying of colors on light terms. It's a color change because your taste and your terminal configuration does not suit you. Propose a patch, maybe Tom will accept it. Regards, -- Sébastien Luttringer www.seblu.net
On 04/05/11 09:18, Sebastien Luttringer wrote:
Signed-off-by: Sebastien Luttringer<seblu@seblu.net> ---
Just as an FYI, we spent quite a bit of time trying to do this as portably and safely as possible in makepkg. Check out how we select colors/boldness/etc at around line 1710 of makepkg. (which could be exactly how you do it in this patch... I have not checked). Allan
On Wed, May 4, 2011 at 1:53 AM, Allan McRae <allan@archlinux.org> wrote:
On 04/05/11 09:18, Sebastien Luttringer wrote:
Signed-off-by: Sebastien Luttringer<seblu@seblu.net> ---
Just as an FYI, we spent quite a bit of time trying to do this as portably and safely as possible in makepkg. Check out how we select colors/boldness/etc at around line 1710 of makepkg. (which could be exactly how you do it in this patch... I have not checked).
Very interesting. I will update my patch with tput method. Thanks! -- Sébastien Luttringer www.seblu.net
participants (5)
-
Allan McRae
-
Kwpolska
-
Sebastien Luttringer
-
Seblu
-
Tom Gundersen