zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Support more colors
@ 2022-05-10 11:29 subscriptions
  2022-05-10 11:56 ` Mikael Magnusson
  2022-05-10 16:36 ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: subscriptions @ 2022-05-10 11:29 UTC (permalink / raw)
  To: zsh-workers

Terminals support a default and a strong setting for each color. The strong setting is taken for bold text.
However it's currently not possible to also use it for non-bold text or for background color.
By adding the strong colors separately, it's possible to do both by `$fg[strong-color]` and `$bg[strong-color]`.

diff --git a/Functions/Misc/colors b/Functions/Misc/colors

index 5e9d77d10..860491f02 100644

--- a/Functions/Misc/colors

+++ b/Functions/Misc/colors

@@ -63,6 +63,16 @@ color=(

  # 63 double-overline-or-left

  # 64 stress

  # 65 no-ideogram-marking

+

+# Strong color codes

+  90 strong-gray            100 bg-strong-gray

+  91 strong-red             101 bg-strong-red

+  92 strong-green           102 bg-strong-green

+  93 strong-yellow          103 bg-strong-yellow

+  94 strong-blue            104 bg-strong-blue

+  95 strong-magenta         105 bg-strong-magenta

+  96 strong-cyan            106 bg-strong-cyan

+  97 strong-white           107 bg-strong-white

  )

  

  # A word about black and white:  The "normal" shade of white is really a

@@ -80,6 +90,7 @@ for k in ${(k)color}; do color[${color[$k]}]=$k; done

  # Add "fg-" keys for all the text colors, for clarity.

  

  for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k; done

+for k in ${color[(I)9?]}; do color[fg-${color[$k]}]=$k; done

  

  # This is inaccurate, but the prompt theme system needs it.

  




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-10 11:29 [PATCH] Support more colors subscriptions
@ 2022-05-10 11:56 ` Mikael Magnusson
  2022-05-10 16:32   ` Bart Schaefer
  2022-05-10 16:36 ` Bart Schaefer
  1 sibling, 1 reply; 9+ messages in thread
From: Mikael Magnusson @ 2022-05-10 11:56 UTC (permalink / raw)
  To: subscriptions; +Cc: zsh-workers

On 5/10/22, subscriptions@pygos.space <subscriptions@pygos.space> wrote:
> Terminals support a default and a strong setting for each color. The strong
> setting is taken for bold text.
> However it's currently not possible to also use it for non-bold text or for
> background color.
> By adding the strong colors separately, it's possible to do both by
> `$fg[strong-color]` and `$bg[strong-color]`.

colors is more or less obsoleted by the %F prompt escape already,
which already lets you use any color the terminal supports. For
example, %F{2} is green, and %F{10} (add 8) is what you call
"strong-green".

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-10 11:56 ` Mikael Magnusson
@ 2022-05-10 16:32   ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2022-05-10 16:32 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, May 10, 2022 at 4:57 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> colors is more or less obsoleted by the %F prompt escape already,
> which already lets you use any color the terminal supports.

The advantage of "colors" has always been in giving symbolic names to
things rather than in enabling use of the terminal capability.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-10 11:29 [PATCH] Support more colors subscriptions
  2022-05-10 11:56 ` Mikael Magnusson
@ 2022-05-10 16:36 ` Bart Schaefer
  2022-05-12 21:19   ` Jan Breig
  1 sibling, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2022-05-10 16:36 UTC (permalink / raw)
  To: subscriptions; +Cc: Zsh hackers list

On Tue, May 10, 2022 at 4:32 AM <subscriptions@pygos.space> wrote:
>
> Terminals support a default and a strong setting for each color.

Thanks for the suggestion, but your email client or server has mangled
the diff.  Can you attach it as a .txt file?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-10 16:36 ` Bart Schaefer
@ 2022-05-12 21:19   ` Jan Breig
  2022-05-13  2:55     ` Bart Schaefer
  2022-05-13  4:09     ` Lawrence Velázquez
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Breig @ 2022-05-12 21:19 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

> Thanks for the suggestion, but your email client or server has 
> mangled the diff.  Can you attach it as a .txt file?
Yes, sorry that was due to CRLF/LF conversion.
This one should work:


diff --git a/Functions/Misc/colors b/Functions/Misc/colors
index 027ca9a..49d44f9 100644
--- a/Functions/Misc/colors
+++ b/Functions/Misc/colors
@@ -62,6 +62,16 @@ color=(
  # 63 double-overline-or-left
  # 64 stress
  # 65 no-ideogram-marking
+
+# Strong color codes
+  90 strong-gray            100 bg-strong-gray
+  91 strong-red             101 bg-strong-red
+  92 strong-green           102 bg-strong-green
+  93 strong-yellow          103 bg-strong-yellow
+  94 strong-blue            104 bg-strong-blue
+  95 strong-magenta         105 bg-strong-magenta
+  96 strong-cyan            106 bg-strong-cyan
+  97 strong-white           107 bg-strong-white
  )

  # A word about black and white:  The "normal" shade of white is really
@@ -79,6 +89,7 @@ for k in ${(k)color}; do color[${color[$k]}]=$k; done
  # Add "fg-" keys for all the text colors, for clarity.

  for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k; done
+for k in ${color[(I)9?]}; do color[fg-${color[$k]}]=$k; done

  # This is inaccurate, but the prompt theme system needs it.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-12 21:19   ` Jan Breig
@ 2022-05-13  2:55     ` Bart Schaefer
  2022-05-13  4:09     ` Lawrence Velázquez
  1 sibling, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2022-05-13  2:55 UTC (permalink / raw)
  To: Jan Breig; +Cc: Zsh hackers list

Thanks again.  This won't make it into the 5.9 release but will be in
git thereafter.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-12 21:19   ` Jan Breig
  2022-05-13  2:55     ` Bart Schaefer
@ 2022-05-13  4:09     ` Lawrence Velázquez
  2022-05-13  6:30       ` Jan Breig
  1 sibling, 1 reply; 9+ messages in thread
From: Lawrence Velázquez @ 2022-05-13  4:09 UTC (permalink / raw)
  To: Jan Breig; +Cc: zsh-workers

On Thu, May 12, 2022, at 5:19 PM, Jan Breig wrote:
> +# Strong color codes
> +  90 strong-gray            100 bg-strong-gray
> +  91 strong-red             101 bg-strong-red
> +  92 strong-green           102 bg-strong-green
> +  93 strong-yellow          103 bg-strong-yellow
> +  94 strong-blue            104 bg-strong-blue
> +  95 strong-magenta         105 bg-strong-magenta
> +  96 strong-cyan            106 bg-strong-cyan
> +  97 strong-white           107 bg-strong-white
>   )

What is the rationale for calling these "strong"?  I don't think
I've ever seen them referred to as anything other than "bright".
See the xterm documentation, for example:

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_
https://invisible-island.net/xterm/xterm.faq.html#bold_vs_16colors

I would prefer these be called "*bright-*" to avoid unnecessary
terminological discrepancy.  If "strong" really is more common than
I think (entirely possible!), then the "*strong-*" names could be
included as additional reverse-mapped keys, but I would still
advocate for the numbered keys to have "*bright-*" values.

>   for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k; done
> +for k in ${color[(I)9?]}; do color[fg-${color[$k]}]=$k; done

I think these two lines could be expressed as

    for k in ${color[(I)[39]?]}; do color[fg-${color[$k]}]=$k; done

...

Tangentially, as I understand it SGR 90-97 and 100-107 are not
standardized by ECMA-48 ("ANSI") but are an extension.  This is not
really a problem, but the comments should be updated so they do not
imply that bright colors are ANSI.

-- 
vq


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-13  4:09     ` Lawrence Velázquez
@ 2022-05-13  6:30       ` Jan Breig
  2022-05-13 19:16         ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Breig @ 2022-05-13  6:30 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-workers

> What is the rationale for calling these "strong"?  I don't think
> I've ever seen them referred to as anything other than "bright".

"Strong" was entirely made up by me. I didn't want to use "bold"
because is may cause confusion with bold text. "Bright" is fine.

> I think these two lines could be expressed as
> 
> for k in ${color[(I)[39]?]}; do color[fg-${color[$k]}]=$k; done
> 

LGTM


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Support more colors
  2022-05-13  6:30       ` Jan Breig
@ 2022-05-13 19:16         ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2022-05-13 19:16 UTC (permalink / raw)
  To: Jan Breig; +Cc: Lawrence Velázquez, Zsh hackers list

On Thu, May 12, 2022 at 11:31 PM Jan Breig <subscriptions@pygos.space> wrote:
>
> "Strong" was entirely made up by me. I didn't want to use "bold"
> because is may cause confusion with bold text. "Bright" is fine.

I'll tweak this before committing.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-13 19:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 11:29 [PATCH] Support more colors subscriptions
2022-05-10 11:56 ` Mikael Magnusson
2022-05-10 16:32   ` Bart Schaefer
2022-05-10 16:36 ` Bart Schaefer
2022-05-12 21:19   ` Jan Breig
2022-05-13  2:55     ` Bart Schaefer
2022-05-13  4:09     ` Lawrence Velázquez
2022-05-13  6:30       ` Jan Breig
2022-05-13 19:16         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).