How do I make the terminal background bright white?

5,168

It depends on the terminal. As a rule, you cannot do this using "ANSI colors", because (while some terminals interpret the bold video attribute as "bright colors"), there is no standard way to change the brightness of the background.

Some terminals support escape sequences for changing the color palette used by the terminal independently of "ANSI colors". Xterm does this, for instance, using the dynamic colors feature, which allows changing the default foreground and background colors (as well as a few other possibilities such as the cursor color). Those are summarized in the Operating System Controls section of XTerm Control Sequences:

OSC Ps ; Pt ST
OSC Ps ; Pt BEL
          Set Text Parameters.  For colors and font, if Pt is a "?", the
          control sequence elicits a response which consists of the con-
          trol sequence which would set the corresponding value.  The
          dtterm control sequences allow you to determine the icon name
          and window title.
...
          The 10 colors (below) which may be set or queried using 1 0
          through 1 9  are denoted dynamic colors, since the correspond-
          ing control sequences were the first means for setting xterm's
          colors dynamically, i.e., after it was started.  They are not
          the same as the ANSI colors.  These controls may be disabled
          using the allowColorOps resource.  At least one parameter is
          expected for Pt.  Each successive parameter changes the next
          color in the list.  The value of Ps tells the starting point
          in the list.  The colors are specified by name or RGB specifi-
          cation as per XParseColor.
...
            Ps = 1 0  -> Change VT100 text foreground color to Pt.
            Ps = 1 1  -> Change VT100 text background color to Pt.
            Ps = 1 2  -> Change text cursor color to Pt.
            Ps = 1 3  -> Change mouse foreground color to Pt.
            Ps = 1 4  -> Change mouse background color to Pt.
            Ps = 1 5  -> Change Tektronix foreground color to Pt.
            Ps = 1 6  -> Change Tektronix background color to Pt.
            Ps = 1 7  -> Change highlight background color to Pt.
            Ps = 1 8  -> Change Tektronix cursor color to Pt.
            Ps = 1 9  -> Change highlight foreground color to Pt.

Lacking that feature, some other terminals allow changing the values of the "ANSI colors". Again, in xterm, still in the set of operating system controls:

          Ps = 4 ; c; spec -> Change Color Number c to the color spec-
          ified by spec.  This can be a name or RGB specification as per
          XParseColor.  Any number of c/spec pairs may be given.  The
          color numbers correspond to the ANSI colors 0-7, their bright
          versions 8-15, and if supported, the remainder of the 88-color
          or 256-color table.

While some other terminal emulators may implement one or both of these, as a rule they do not document that. You would have to experiment to find whether they work for other terminals.

Along the same lines of the latter (modify values in the color palette), the Linux console supports a control sequence which can change its 16-color palette. Xterm does not support that control because it does not follow the formatting standard (ECMA-48).

The xtermcontrol program supports some of these escape sequences, in particular the ones for dynamic color. But you can make a script, e.g.,

#!/bin/sh
printf '\033]%s;%s\007' $1 $2

and set a color using that script

myscript 11 rgb:ff/ff/ff

Further reading:

Share:
5,168

Related videos on Youtube

Z0q
Author by

Z0q

Updated on September 18, 2022

Comments

  • Z0q
    Z0q over 1 year

    I am using:

    setterm --foreground blue --background white --blink on
    

    The result is that the text is blue on bright white. However, the background around the text is grey. How can I make the entire background bright white?