Skip to contentSkip to conversation

global fdisk colors disable

DISCUSSION Felix Miata 4 participants 11 messages Jan 15, 2014 – Jan 16, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output. I see nothing in the man page about any kind of config file. I don't think there's ever been a reason to configure it before.

Signature · 6 lines
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

  Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
maintainer
#1 lore raw
Quoted 2 lines · Felix Miata

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output.

Does it mean that fdisk output is broken or you just don't like colors? You can use:

alias fdisk=fdisk -L=never

in your shell profile or rc file.

Quoted 3 lines

I see nothing in the
man page about any kind of config file. I don't think there's ever been a reason to configure it before.

Well, I guess that more people prefer colorized output so this feature is enabled by default.

I have already thought about it and it would be probably nice to have a way how to globally configure colors for all command line utils (e.g. util-linux, coreutils, ...).

It seems we have no standard and package independent solution now, so distributions use things like "alias" in shell profile files (for example for ls(1), grep(1), ...). It would be nice to have at least global variable (something like COLOR_MODE={auto,never,always}) to avoid aliases with --color= option. (CC: Padraig ;-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 23 lines · Karel Zak
Quoted 2 lines · Felix Miata

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output.

Does it mean that fdisk output is broken or you just don't like colors? You can use:

alias fdisk=fdisk -L=never

in your shell profile or rc file.

Quoted 3 lines

I see nothing in the
man page about any kind of config file. I don't think there's ever been a reason to configure it before.

Well, I guess that more people prefer colorized output so this feature is enabled by default.

I have already thought about it and it would be probably nice to have a way how to globally configure colors for all command line utils (e.g. util-linux, coreutils, ...).

Quoted 5 lines

It seems we have no standard and package independent solution now, so distributions use things like "alias" in shell profile files (for example for ls(1), grep(1), ...). It would be nice to have at least global variable (something like COLOR_MODE={auto,never,always}) to avoid aliases with --color= option. (CC: Padraig ;-)

I think the current mechanism used is best.
I.E. default to showing colors when possible but give an option to disable. Global env vars come with their own disadvantages.

However I will say that one has to be careful when using colors, and the use in fdisk seems a bit redundant. I.E. colors are useful to distinguish things, like the portion of a match in grep or the type of a file in ls. I'm not sure the items distinguished in fdisk non obvious and worth the hassle of worrying about color.

thanks,
Pádraig.

maintainer
#3 lore raw
Quoted 24 lines · Pádraig Brady
Quoted 23 lines · Karel Zak
Quoted 2 lines · Felix Miata

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output.

Does it mean that fdisk output is broken or you just don't like colors? You can use:

alias fdisk=fdisk -L=never

in your shell profile or rc file.

Quoted 3 lines

I see nothing in the
man page about any kind of config file. I don't think there's ever been a reason to configure it before.

Well, I guess that more people prefer colorized output so this feature is enabled by default.

I have already thought about it and it would be probably nice to have a way how to globally configure colors for all command line utils (e.g. util-linux, coreutils, ...).

Quoted 8 lines
Quoted 5 lines

It seems we have no standard and package independent solution now, so distributions use things like "alias" in shell profile files (for example for ls(1), grep(1), ...). It would be nice to have at least global variable (something like COLOR_MODE={auto,never,always}) to avoid aliases with --color= option. (CC: Padraig ;-)

I think the current mechanism used is best.
I.E. default to showing colors when possible but give an option to disable.

As I made note on g+, on many places is the default not to show colors, so we all have --color=auto aliases in shell profile files :-)

BTW, dmesg supports colors, but it's disabled by default -- what about to enable it by default? (I don't want to add Fedora specific /etc/profile.d/colordmesg.sh ...).

Quoted 1 line

Global env vars come with their own disadvantages.

Yes.

Quoted 4 lines

However I will say that one has to be careful when using colors, and the use in fdisk seems a bit redundant. I.E. colors are useful to distinguish things, like the portion of a match in grep or the type of a file in ls. I'm not sure the items distinguished

That's exactly how fdisk uses colors :-) The another story are warning and error messages, my experience is that people don't read it, so now it's in red.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw
In reply to Karel Zak

On 2014-01-15 09:27 (GMT+0100) Karel Zak composed:

Quoted 7 lines · Felix Miata
Quoted 3 lines

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output.

Does it mean that fdisk output is broken or you just don't like colors? You can use:

How about I defer answering that until you look at this image I should have included in my OP:

http://fm.no-ip.com/SS/colorsTTYbadFdisk.png

I hope you can understand the problem this way. It's much like web page designers have taken to doing the past few years, trying to be "helpful" by using gray text instead of black, ostensibly to compensate for harshness of maladjusted displays without considering impact on correctly adjusted displays.

Exactly what in that image is the non-default color supposed to be conveying?

Quoted 3 lines

alias fdisk=fdisk -L=never

in your shell profile or rc file.

That seems to have ignored a keyword in $SUBJECT: global

I have many logins on many installations. In what global config file (e.g. Debian, Fedora, Gentoo, Knoppix, Mageia, openSUSE, Slackware, etc.) can I make never the default for all users?

Quoted 6 lines
Quoted 3 lines

I see nothing in the
man page about any kind of config file. I don't think there's ever been a reason to configure it before.

Well, I guess that more people prefer colorized output so this feature is enabled by default.

Colors that have a standard meaning in a common context can make sense, but as likely colors confuse, besides reducing contrast. cf.:

http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Usability/Color "Colors must be used carefully..."

http://www.webdesignref.com/chapters/13/ch13-16.htm "To avoid color contrast problems, white and black always make a good pairing..."

http://usabilitygeek.com/12-typography-guidelines-for-good-website-usability/ "Avoid colouring text in red or green..."

Orange on a 16 color display doesn't look much different than red. Both contrast poorly unless the background is white, detracting from any value as warning intended by those color choices.

Quoted 3 lines

I have already thought about it and it would be probably nice to have a way how to globally configure colors for all command line utils (e.g. util-linux, coreutils, ...).

I'm pretty sure all other utils I commonly use have a way to turn off color globally. Some utils don't, so I don't use them unless no alternative exists. There really is no practical alternative to fdisk -l that I'm aware of.

Quoted 5 lines

It seems we have no standard and package independent solution now, so distributions use things like "alias" in shell profile files (for example for ls(1), grep(1), ...). It would be nice to have at least global variable (something like COLOR_MODE={auto,never,always}) to avoid aliases with --color= option. (CC: Padraig ;-)

One reason I use the ttys is for comfort, a pleasant environment where legibility is maximized, in part by big bold text, in part by lack of distraction from other windows and widgets, in other part by using only the two colors of my choice. In that environment I don't want or need to be "warned" by colors I can barely see.

Maybe what I need is a way to prevent framebuffer ttys
from using any but the two colors of my choice. Anyone know if that's possible?

Signature · 6 lines
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
#4 lore raw
In reply to Pádraig Brady

On 2014-01-15 09:30 (GMT) Pádraig Brady composed:

Quoted 1 line

I think the current mechanism used is best.

What mechanism are you referring to, needing an override switch on every invocation on an alien system?

Quoted 1 line

I.E. default to showing colors when possible but give an option to disable.

$SUBJECT Keyword: global.

Quoted 1 line

Global env vars come with their own disadvantages.

+1

Quoted 1 line

However I will say that one has to be careful when using colors,

Exactly.

Quoted 1 line

and the use in fdisk seems a bit redundant.

I think orthogonal is the better word than redundant.

Quoted 4 lines

I.E. colors are useful
to distinguish things, like the portion of a match in grep or the type of a file in ls. I'm not sure the items distinguished in fdisk non obvious and worth the hassle of worrying about color.

Indeed.

Signature · 6 lines
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
#6 lore raw
In reply to Felix Miata
Quoted 3 lines · On Wednesday 15 January 2014 09:10:19 Felix Miata wrote:

I have many logins on many installations. In what global config file (e.g. Debian, Fedora, Gentoo, Knoppix, Mageia, openSUSE, Slackware, etc.) can I make never the default for all users?

/etc/profile

or use ~/.bashrc and set up a system that syncs your ~/ files

if there was an env var, you could configure ~/.ssh/config to forward specific env vars to the remote host automatically
-mike

maintainer
#9 lore raw
In reply to Felix Miata
Quoted 7 lines · Felix Miata

On 2014-01-15 09:27 (GMT+0100) Karel Zak composed:

Quoted 4 lines · Felix Miata
Quoted 3 lines

Is there a way to do $SUBJECT? One really shouldn't have to resort to using -L on every invocation to be able to see fdisk output.

Quoted 7 lines
Quoted 2 lines

Does it mean that fdisk output is broken or you just don't like colors? You can use:

How about I defer answering that until you look at this image I should have included in my OP:

http://fm.no-ip.com/SS/colorsTTYbadFdisk.png

Well, for me is the output pretty readable, but I understand that for someone else it could be difficult.

If I run "xterm -bg blue -fg white" then ls(1) output on Fedora is absolutely useless, does it mean that coreutils/Fedora use stupid defaults?

Quoted 1 line

Exactly what in that image is the non-default color supposed to be conveying?

make the header more readable ;-)

Quoted 5 lines
Quoted 3 lines

alias fdisk=fdisk -L=never

in your shell profile or rc file.

That seems to have ignored a keyword in $SUBJECT: global

I don't think so.

Quoted 3 lines

I have many logins on many installations. In what global config file (e.g. Debian, Fedora, Gentoo, Knoppix, Mageia, openSUSE, Slackware, etc.) can I make never the default for all users?

depends on distro... for example /etc/profile.d/*

Quoted 3 lines

Orange on a 16 color display doesn't look much different than red. Both contrast poorly unless the background is white, detracting from any value as warning intended by those color choices.

so your suggestion is to disable the colors at all for all Linux boxes by default?

I understand your point of view, but I'd like to use default that is usable to majority of the Linux users.

Quoted 8 lines
Quoted 3 lines

I have already thought about it and it would be probably nice to have a way how to globally configure colors for all command line utils (e.g. util-linux, coreutils, ...).

I'm pretty sure all other utils I commonly use have a way to turn off color globally. Some utils don't, so I don't use them unless no alternative exists. There really is no practical alternative to fdisk -l that I'm aware of.

See the problem from opposite side -- for example grep and ls have disabled colors by default, so many distributions have things like:

         alias egrep='egrep --color=tty'
         alias fgrep='fgrep --color=tty'
         alias grep='grep --color=tty'
         alias l.='ls -d .* --color=auto'
         alias ll='ls -l --color=auto'
         alias ls='ls --color=auto'

in /etc/profile.d/ to overwrite the default...

Quoted 11 lines
Quoted 5 lines

It seems we have no standard and package independent solution now, so distributions use things like "alias" in shell profile files (for example for ls(1), grep(1), ...). It would be nice to have at least global variable (something like COLOR_MODE={auto,never,always}) to avoid aliases with --color= option. (CC: Padraig ;-)

One reason I use the ttys is for comfort, a pleasant environment where legibility is maximized, in part by big bold text, in part by lack of distraction from other windows and widgets, in other part by using only the two colors of my choice. In that environment I don't want or need to be "warned" by colors I can barely see.

I understand.. it would be nice to have a one place to disable/enable colors for all terminal utils, maybe something like

/etc/terminal-colors.d/[<utilname>.]disable

I'm going to resolve the problem for the next v2.25. Thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#10 lore raw

On 2014-01-15 18:11 (GMT+0100) Karel Zak composed:

Quoted 8 lines · Felix Miata
Quoted 4 lines

Orange on a 16 color display doesn't look much different than red. Both contrast poorly unless the background is white, detracting from any value as warning intended by those color choices.

so your suggestion is to disable the colors at all for all Linux boxes by default?

I've been using white on blue text modes for nearly 3 decades, ever since I learned to use ansi to set screen colors in DOS 3, as I find white on black rather unpleasant to need to use more than occasionally.

Probably better to have some option for a user or admin to force the ttys into 2 or 4 color mode regardless whether the system is capable of or happiest with 8, 15, 16, 24 or more.

Quoted 2 lines

I understand your point of view, but I'd like to use default that is usable to majority of the Linux users.

That is a typical majority rule effect. The problem is those with poorer than average vision by definition are both a minority and handicapped. From that it apparently follows that making it more difficult for the minority already handicapped must be OK because the majority of average or better people might enjoy some colors that may or may not make sense or provide real enhancement.

Quoted 6 lines
Quoted 5 lines

One reason I use the ttys is for comfort, a pleasant environment where legibility is maximized, in part by big bold text, in part by lack of distraction from other windows and widgets, in other part by using only the two colors of my choice. In that environment I don't want or need to be "warned" by colors I can barely see.

Quoted 6 lines

I understand.. it would be nice to have a one place to disable/enable colors for all terminal utils, maybe something like

/etc/terminal-colors.d/[<utilname>.]disable

I'm going to resolve the problem for the next v2.25. Thanks!

Thank you! This sounds like it should be a good option for many.

Signature · 6 lines
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
#7 lore raw
In reply to Mike Frysinger

On 2014-01-15 10:21 (GMT-0500) Mike Frysinger composed:

Quoted 7 lines · On Wednesday 15 January 2014 09:10:19 Felix Miata wrote:
Quoted 4 lines

I have many logins on many installations. In what global config file (e.g. Debian, Fedora, Gentoo, Knoppix, Mageia, openSUSE, Slackware, etc.) can I make never the default for all users?

/etc/profile

That always seems to have a rather recent date, even though I never touch it. Are you sure you don't mean /etc/profile.local?

Quoted 1 line

or use ~/.bashrc and set up a system that syncs your ~/ files

Too complicated for me. I don't use identical .bashrc content for every login or every installation. Earlier in thread Karel Zak indicated he has a nice solution planned for next release.

Quoted 2 lines

if there was an env var, you could configure ~/.ssh/config to forward specific env vars to the remote host automatically

Signature · 6 lines
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
maintainer
#8 lore raw
Quoted 4 lines · Felix Miata

On 2014-01-15 10:21 (GMT-0500) Mike Frysinger composed:

Quoted 1 line · On Wednesday 15 January 2014 09:10:19 Felix Miata wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I have many logins on many installations. In what global config file (e.g. Debian, Fedora, Gentoo, Knoppix, Mageia, openSUSE, Slackware, etc.) can I make never the default for all users?

/etc/profile

That always seems to have a rather recent date, even though I never touch it. Are you sure you don't mean /etc/profile.local?

For example Fedora uses /etc/profile where is:

for i in /etc/profile.d/*.sh ; do

    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then 
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi

done

and in the /etc/profile.d/ directory are many scripts, for example /etc/profile.d/colorls.sh with --color=auto alias for ls(1).

It's pretty common that people and packages add/modify the stuff in the /etc/profile.d/ directory.

IMHO it's elegant way how to maintain global configuration for shells.

The files like ~/.bash_profile are users' playground and I don't think that good admin touches these ~/ files.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com