[Toybox] Question about --color

enh enh at google.com
Wed Aug 10 08:02:04 PDT 2022


i don't have a _technical_ reason, but i will say i've always hated `ls
--color` and the first thing i do on a new OS install is _delete_ those
default aliases.

(actually, trying to translate that into a technical reason: you can't ask
terminals what the rgb value for an ansi color is, and you can't even ask
whether there's a dark-on-light or light-on-dark scheme, so you can't
really guarantee that your default colors are at all visible. see also:
accessibility issues for people with various kinds of color vision
deficiencies.)

since i don't have any issues with red or green on a dark background in any
terminal i've used, i don't actually mind `diff --color` and whenever a new
git install asks me whether i can see the diff i just choose "yeah,
whatever". it's blue/magenta on dark or yellow/green on light that i find
problematic. (what rgb values "yellow" actually comes out as varies the
most widely between terminals of any color.)

On Wed, Aug 10, 2022 at 3:34 AM Rob Landley <rob at landley.net> wrote:

> Since diff also supports --color I'm trying to genericize the plumbing
> into lib
> but would it make sense for things like ls that can color their output to
> just
> do that by default?
>
> Right now if you say --color that defaults to --color=auto but if you
> DON'T say
> --color it's equivalent to --color=never. So you can set up a shell alias
> to
> color the output, but you won't just naturally get it.
>
> Except... it's checking if stdout is a tty? Shouldn't it always be ok to
> output
> color escapes to a tty, and when you don't want it to you can say say
> --color=never or pipe it to cat or something? Stuff like ABC="$(command)"
> is
> automatically going to lose the color because output isn't to a tty.
>
> So it seems like when you DON'T say --color, ls and diff should default to
> --color=auto? And that way we don't have to alias them?
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20220810/49191304/attachment.htm>


More information about the Toybox mailing list