From: Sirius <sirius@trudheim.com>
To: Gedalya <gedalya@gedalya.net>
Cc: netdev@vger.kernel.org
Subject: Re: iproute2: color output should assume dark background
Date: Thu, 23 May 2024 10:05:48 +0200 [thread overview]
Message-ID: <Zk743CuHshWWVJq5@photonic.trudheim.com> (raw)
In-Reply-To: <Zk722SwDWVe35Ssu@photonic.trudheim.com>
In days of yore (Thu, 23 May 2024), Sirius thus quoth:
> In days of yore (Thu, 23 May 2024), Gedalya thus quoth:
> > On 5/23/24 2:39 PM, Sirius wrote:
> > > read what the background is of the console
> > That's COLORFGBG. It is set by some terminal emulators as a way to
> > advertise the colors being used.
> >
> > I'm no expert but AFAIK there is no uniform way to do this that is
> > supported by all major terminal emulators.
>
> https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Control-Bytes_-Characters_-and-Sequences
> https://stackoverflow.com/questions/2507337/how-to-determine-a-terminals-background-color
>
> If you colour the output, then handling the prospect that the background
> might not be the assumed colour kind of comes with the territory.
> Or you deliberately set the background colour to something so that it is
> not undefined. That is what the ANSI colour sequences can do when you use
> strings like \e[32;47m where you deliberately set the background.
https://github.com/dalance/termbg
Someone already did the hard work. Just use that library and you can
detect the background colour or whether a theme is light or dark.
--
Kind regards,
/S
next prev parent reply other threads:[~2024-05-23 8:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 19:21 iproute2: color output should assume dark background Gedalya
2024-05-22 19:27 ` Dragan Simic
2024-05-23 6:39 ` Sirius
2024-05-23 7:08 ` Gedalya
2024-05-23 7:57 ` Sirius
2024-05-23 8:05 ` Sirius [this message]
2024-05-23 12:36 ` Dragan Simic
2024-05-23 13:02 ` Sirius
2024-05-23 13:04 ` Gedalya
2024-05-23 13:19 ` Sirius
2024-05-23 13:47 ` Dragan Simic
2024-05-28 9:07 ` David Laight
2024-05-28 9:40 ` Gedalya
2024-05-23 13:23 ` Dragan Simic
2024-05-23 13:39 ` Gedalya
2024-05-23 14:02 ` Dragan Simic
2024-05-23 14:11 ` Gedalya
2024-05-23 14:24 ` Dragan Simic
2024-05-23 14:33 ` Gedalya
2024-05-23 14:59 ` Stephen Hemminger
2024-05-23 15:17 ` Gedalya
2024-05-23 13:50 ` Gedalya
2024-05-23 14:07 ` Dragan Simic
2024-05-23 14:13 ` Gedalya
2024-05-23 14:26 ` Dragan Simic
2024-05-23 14:11 ` Sirius
2024-05-23 14:19 ` Gedalya
2024-05-23 14:28 ` Dragan Simic
2024-05-23 14:29 ` Dragan Simic
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=Zk743CuHshWWVJq5@photonic.trudheim.com \
--to=sirius@trudheim.com \
--cc=gedalya@gedalya.net \
--cc=netdev@vger.kernel.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.
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).