Richard Hartmann | 12 Jul 23:41

Prompt coloring question

Hi all,

for some reason, I am unable to invert the color red ($'%{\e[0;31m%}').
This works with the other colors. Any idea what might cause this?

Richard

KJ Maginnis | 13 Jul 00:15
Favicon

Re: Prompt coloring question

2 questions:

0) What is your TERM variable set to?

1) What terminal emulator are you using?

-KJ

On Sat, 12 Jul 2008, Richard Hartmann wrote:

> Date: Sat, 12 Jul 2008 23:43:34 +0200
> From: Richard Hartmann <richih.mailinglist <at> gmail.com>
> To: Zsh Users <zsh-users <at> sunsite.dk>
> Subject: Prompt coloring question
> 
> Hi all,
>
> for some reason, I am unable to invert the color red ($'%{\e[0;31m%}').
> This works with the other colors. Any idea what might cause this?
>
>
> Richard
>

nullogic <at> sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Richard Hartmann | 13 Jul 00:35

Re: Prompt coloring question

On Sun, Jul 13, 2008 at 00:15, KJ Maginnis <nullogic <at> sdf.lonestar.org> wrote:

> 0) What is your TERM variable set to?

xterm

> 1) What terminal emulator are you using?

konsole 3.5.9

As I said, other colors can be inverted.

RIchard

Phil Pennock | 13 Jul 04:23

Re: Prompt coloring question

On 2008-07-12 at 23:43 +0200, Richard Hartmann wrote:
> for some reason, I am unable to invert the color red ($'%{\e[0;31m%}').
> This works with the other colors. Any idea what might cause this?

Define invert?  The sequence you provide is a reset to default and
normal red text, so you'll need to be clearer about what you want and
what you tried, instead of what you started from.

In my terminal (not the same as what you're using):
"negative image + red display", $'%{\e[7;31m%}' works for me.
"red background", $'%{\e[0;41m%}' works for me.

Regards,
-Phil

Richard Hartmann | 13 Jul 15:37

Re: Prompt coloring question

On Sun, Jul 13, 2008 at 04:23, Phil Pennock
<zsh-workers+phil.pennock <at> spodhuis.org> wrote:

> Define invert?  The sequence you provide is a reset to default and
> normal red text, so you'll need to be clearer about what you want and
> what you tried, instead of what you started from.

I want to use %S and %s to invert the user name so I know I am on a
remote system. While I can easily invert other colors, like light green
( $'%{\e[1;32m%}' ), I can't invert red.

> In my terminal (not the same as what you're using):
> "negative image + red display", $'%{\e[7;31m%}' works for me.
> "red background", $'%{\e[0;41m%}' works for me.

I want to dynamically switch back and forth based on if I am using
SSH to keep an already cluttered prompt setting at least a bit
readable. In case anyone is interested & wants to steal (it is even
girlfriend-compatible(!)):

[ $SSH_TTY ] && ZSHRC_PARENT_SSH=1
[ $WINDOW  ] && ZSHRC_PARENT_SCREEN=1
PROMPT=''
[ $ZSHRC_PARENT_SSH ] && PROMPT+="%S"
[ $USER = 'ilona' ] &&
PROMPT+="%(!.$fg_red%m.$fg_light_purple%n@%m)$fg_no_colour" ||
PROMPT+="%(!.$fg_red%m.$fg_light_green%n@%m)$fg_no_colour"
[ $ZSHRC_PARENT_SSH ] && PROMPT+="%s"
[ $ZSHRC_PARENT_SCREEN ] && PROMPT+="$fg_light_yellow [$WINDOW]"
PROMPT+="$fg_light_blue %~ %# $fg_no_colour"
(Continue reading)

Bart Schaefer | 13 Jul 19:52

Re: Prompt coloring question

On Jul 13,  3:37pm, Richard Hartmann wrote:
} Subject: Re: Prompt coloring question
}
} On Sun, Jul 13, 2008 at 04:23, Phil Pennock
} <zsh-workers+phil.pennock <at> spodhuis.org> wrote:
} 
} > Define invert?  The sequence you provide is a reset to default and
} > normal red text, so you'll need to be clearer about what you want and
} > what you tried, instead of what you started from.
} 
} I want to use %S and %s to invert the user name so I know I am on a
} remote system. While I can easily invert other colors, like light green
} ( $'%{\e[1;32m%}' ), I can't invert red.

Read again what Phil wrote.

$'%{\e[1;32m%}' is not "light green", it's "bold green" -- the "1" is
bold, the "32" is green.  Similarly, $'%{\e[0;31m%}' is not "red", it's
"turn everything else off" (0) and then "red" (31).  That first "0"
disables %S before it has a chance to do anything.  If you were to use
%S%{$'\e[31m'%} without the "0;" it would work as expected.

Richard Hartmann | 13 Jul 21:27

Re: Prompt coloring question

On Sun, Jul 13, 2008 at 19:52, Bart Schaefer <schaefer <at> brasslantern.com> wrote:

> $'%{\e[1;32m%}' is not "light green", it's "bold green" -- the "1" is
> bold, the "32" is green.

I just tried again, at least konsole shows the colors in a lighter shade
when they are prefixed by 1;, perhaps because that is konsole's way
to show bold fonts, I don't, know.

>  Similarly, $'%{\e[0;31m%}' is not "red", it's
> "turn everything else off" (0) and then "red" (31).  That first "0"
> disables %S before it has a chance to do anything.  If you were to use
> %S%{$'\e[31m'%} without the "0;" it would work as expected.

Thanks!

Richard

Bart Schaefer | 13 Jul 23:31

Re: Prompt coloring question

On Jul 13,  9:27pm, Richard Hartmann wrote:
}
} I just tried again, at least konsole shows the colors in a lighter
} shade when they are prefixed by 1;, perhaps because that is konsole's
} way to show bold fonts, I don't, know.

Check out the comments in Functions/Misc/colors.

# Codes listed in this array are from ECMA-48, Section 8.3.117, p. 61.

Does konsole typically use bright text on a dark background rather than
dark text on a white background?  In the former case a lighter color
might be construed as "bold".  (I'm not a KDE person.)

Mikael Magnusson | 13 Jul 23:40
Gravatar

Re: Prompt coloring question

2008/7/13 Bart Schaefer <schaefer <at> brasslantern.com>:
> On Jul 13,  9:27pm, Richard Hartmann wrote:
> }
> } I just tried again, at least konsole shows the colors in a lighter
> } shade when they are prefixed by 1;, perhaps because that is konsole's
> } way to show bold fonts, I don't, know.
>
> Check out the comments in Functions/Misc/colors.
>
> # Codes listed in this array are from ECMA-48, Section 8.3.117, p. 61.
>
> Does konsole typically use bright text on a dark background rather than
> dark text on a white background?  In the former case a lighter color
> might be construed as "bold".  (I'm not a KDE person.)

Looking at konsole's preferences window, it seems to have sort of a backwards
idea of bright/bold. There's a dropdown box that has the 8 colors, and also
a set of 8 "intensive" colors. For each of those 16 you can set the actual
color it uses, and also set if that specific color should be displayed in
a bold font.

--

-- 
Mikael Magnusson

Richard Hartmann | 14 Jul 11:58

Re: Prompt coloring question

On Sun, Jul 13, 2008 at 23:40, Mikael Magnusson <mikachu <at> gmail.com> wrote:

> Looking at konsole's preferences window, it seems to have sort of a backwards
> idea of bright/bold. There's a dropdown box that has the 8 colors, and also
> a set of 8 "intensive" colors. For each of those 16 you can set the actual
> color it uses, and also set if that specific color should be displayed in
> a bold font.

Depending on where I am tonight, I can check out KDE 4's behaviour in this
regard. As there is a i18n string freeze on 3.5, it will probably stay the same
for KDE3, but then, that will not matter for too long.

Richard

Richard Hartmann | 14 Jul 11:56

Re: Prompt coloring question

On Sun, Jul 13, 2008 at 23:31, Bart Schaefer <schaefer <at> brasslantern.com> wrote:

> Does konsole typically use bright text on a dark background rather than
> dark text on a white background?  In the former case a lighter color
> might be construed as "bold".  (I'm not a KDE person.)

The default is black on white. But as Mikael noted, you can change
everything via so-called Schemas.

Richard


Gmane