From: Jim <linux.tech.guy@gmail.com>
To: devs <zsh-workers@zsh.org>
Subject: What appears to be inconsistent results from ${(%):-%F{${subscript}}
Date: Mon, 4 Mar 2024 08:56:26 -0600 [thread overview]
Message-ID: <CA+rB6GLO6B8kx95tPTdFzhwhE+yYk4o2AY64TRnj2FgbeLeibQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]
Hi all,
Output for the following function will help visualize what I believe to be
inconsistencies of the output of ${(%):-%F{${subscript}}.
I would assume %B (background) would yield similar results.
Note the function outputs a solid block character in color.
Hopefully the block charcter will cut and paste correctly.
color_conversion_check () {
local subscript colorconversion
local subscripts
subscripts=(black blue cyan default gray green grey magenta red white
yellow
bright-blue bright-cyan bright-gray bright-green bright-grey
bright-magenta
bright-red bright-white bright-yellow
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 229 230 231
232 233 234 253 254 255
'#000000' '#007fff' '#ff0080' '#abcdef' '#007FFF' '#FF0080' '#ABCDEF'
)
print -- "Output of fg associative array"
print -- "${fg[gray]}${(r.24..█.)}\e[0m ${(V)fg[gray]} fg[gray]"
print -- "${fg[grey]}${(r.24..█.)}\e[0m ${(V)fg[grey]} fg[grey]"
print --
for subscript ($subscripts) {
colorconversion="${(%):-%F{${subscript}}"
print -- "${(%)colorconversion}${(r.24..█.)}\e[0m
${(V)colorconversion} ${subscript}"
}
}
First, '${(%):-%F{${subscript}}' has unbalanced curly brackets({}), but
still works.
Adding a closing bracket(}) results in '}' being added to the output. So
instead of
getting ',,,m' you get '...m}'. I'm confused. What am I missing?
To my original point
1) the color names grey and gray do not output black but output the default
2) bright color names are not converted but output the default color
Should bright color names be added to the code?
As you can see in 3) the code for bright colors is there
3) using decimal numbers(0-255)
0 - 15 uses 30-27 and 90-97(bright) instead of using the colors defined
by the terminal
NOTE: 0-15 are defined even for TERM=linux
16-255 uses the colors defined by the terminal
Is there a reason why it doesn't use the terminal colors for 0-15?
Hex codes appear to work as expected.
Regards,
Jim Murphy
[-- Attachment #2: Type: text/html, Size: 2750 bytes --]
next reply other threads:[~2024-03-04 14:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 14:56 Jim [this message]
2024-03-04 15:07 ` Jim
2024-03-04 18:06 ` Mikael Magnusson
2024-03-04 22:28 ` Bart Schaefer
2024-03-04 22:50 ` Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+rB6GLO6B8kx95tPTdFzhwhE+yYk4o2AY64TRnj2FgbeLeibQ@mail.gmail.com \
--to=linux.tech.guy@gmail.com \
--cc=linuxtechguy@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).