#953591 bash: colors should be enabled by default (force_color_prompt)

Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
Cameron Tacklind
Date:
2023-10-09 08:21:02 UTC
Severity:
minor
Tags:
#953591#5
Date:
2020-03-10 22:48:19 UTC
From:
To:
Dear Maintainer,

It is now 2020 and colors on a terminal are generally very well supported.
That colors are not enabled by default does not make sense to me. When a
terminal does not support colors, I've rarely, if ever, had that
incorrectly detected.

The Debian Wiki for [BashColors](https://wiki.debian.org/BashColors)
says "Its output can be colorized to increase human readability." However,
that seems to go against the text in `/etc/skel/.bashrc` that states
colors are "turned off by default to not distract the user".

Frankly, imho, the reasoning in the `.bashrc` file does not make sense,
nor does it to all of the people that have commented on the Stack
Exchange post referenced on the Wiki (the title, and thus URL, has been
changed and thus the link in the wiki is broken):
https://unix.stackexchange.com/questions/329581/why-is-debians-default-bash-shell-colorless

It looks to me like the Debian package is where the offending `.bashrc`
is defined and thus copied to many other systems.

It is my opinion that the color handling section of `.bashrc` should be
rewritten. There is already some confusion about `force_color_prompt`
because it does not *force* colors in all cases. I think a more
appropriate variable/setting would be something like `colorless_prompt`
or `force_colorless_prompt` for those that prefer bash to be colorless.

Thank you for considering this request.

#953591#14
Date:
2023-10-09 03:00:20 UTC
From:
To:
I wrote a patch to address #1026379 that I feel would be appropriate
here too. As I noted there, using tput for detection basically means
having ncurses-bin as a Recommends, so we may want a better way of doing
this detection.

#953591#19
Date:
2023-10-09 08:17:07 UTC
From:
To:
is it more portable to use the previous check of tput (tput setaf 1) than
tput colors?

https://codeyarns.com/tech/2015-03-18-how-to-check-colors-supported-by-terminal.html#gsc.tab=0
is from 2015 but i expect there are worse offenders out there

you should also check that tput is available and send any errors to
dev/null i think

has the new version been tested inside screen/tmux (and nested variations)
and over ssh (with tmux/screen on both ends)? --- i think that is why there
were hardcoded checks for common variants of  $TERM