Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1687141 - Gnome terminal display light colours incorrectly
Summary: Gnome terminal display light colours incorrectly
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-terminal
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-10 09:12 UTC by Pavel Stehule
Modified: 2019-03-11 22:47 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Pavel Stehule 2019-03-10 09:12:13 UTC
Description of problem:

Some colours are not displayed correctly in gnome-terminal. Originally the YELLOW colour is shown like brown colour. Really yellow colour you will get when you use a BOLD attribute. There was a option like "show bold text as really bold", but colours worked every body. After update, the BOLD attribute is ignored by default, and correct behave is active after enable a option "show bold colours in light colours". This is a compatibility break - and it doesn't work in some other applications like terminator. More, it has not sense for ncurses applications.

Version-Release number of selected component (if applicable):


How reproducible:

#include <ncurses.h>

int main()
{
    initscr();
    start_color();
    init_pair(2, COLOR_YELLOW, COLOR_BLUE);
    attron(COLOR_PAIR(2));
    mvaddstr(10, 10, "Ahoj"); // SHOULD BE BROWN
    attron(A_BOLD);
    mvaddstr(11, 10, "Ahoj"); // SHOULD BE YELLOW
    getch();
    endwin();
    return 0;
}

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Egmont Koblinger 2019-03-11 00:18:03 UTC
This change was discussed in the comments of https://bugzilla.gnome.org/show_bug.cgi?id=762247, agreed by VTE / GNOME Terminal developers, and is not without precedence in other emulators. Please see over there for the rationale behind this change.

> the BOLD attribute is ignored by default

No, it's not ignored, it makes the text – drumroll – bold.

> and correct behave is active after enable a option "show bold colours in light colours"

According to ECMA-48's definition, the corresponding escape sequence enables "bold or increased intensity", so the new default behavior is also correct.

> This is a compatibility break

This change indeed breaks certain things – for apps that make false expectations. They should be fixed.

> it doesn't work in some other applications like terminator

Many VTE-based frontends have been notified about this forthcoming change, e.g. Terminator at https://bugs.launchpad.net/terminator/+bug/1740311 more than a year ago about the introduction of this new config option, and more than half a year ago about the flip of the default. They had plenty of time to catch up.

> More, it has not sense for ncurses applications.

Asking for YELLOW and expecting it to be brown; asking for BOLD YELLOW and expecting it to be yellow is what doesn't make any sense to me.

Please accept this mainstream change. Apps will probably get fixed in the next few years to ask for the desired color/boldness in a way that works fine with the new setting (and the old one, too). The new default will push/force them to do it. Until then, the backwards compatibility checkbox remains there for users who run into more severe problems.

Comment 2 Pavel Stehule 2019-03-11 19:56:20 UTC
I agree so it is strange. But currently there are not API how to get yellow colour. And now I am asking YELLOW and I got BROWN, and I am asking BOLD YELLOW, and I got BOLD BROWN, so it looks little bit more strange than before.

Looks like unhappy order of changes. This change should be fixed first on ncurses level. I cannot to fix it on application level.

Comment 3 Egmont Koblinger 2019-03-11 22:47:52 UTC
>  And now I am asking YELLOW and I got BROWN, and I am asking BOLD YELLOW, and I got BOLD BROWN, so it looks little bit more strange than before.

Dunno, to me, a symbolic constant COLOR_YELLOW always resulting in brown is less strange than it resulting in brown vs. yellow depending on the font weight. A flag called A_BOLD changing not only boldness but also the color doesn't sound right to me at all.

Also how would you get the darker color in bold, then? It's a common request, e.g. just today someone filed this as a bugreport for Konsole, asking for GNOME Terminal's new behavior to be implemented there too.


> This change should be fixed first on ncurses level. I cannot to fix it on application level.

You _can_ fix it in your ncurses app.

ncurses defines 8 named color constants, like COLOR_YELLOW, which are actually just numbers from 0 to 7. But the available colors don't stop here.

These names are quite misleading, e.g. COLOR_YELLOW often means brown, COLOR_WHITE often means a light gray. Users can redefine these colors arbitrarily, using their terminal emulator's settings, or escape sequences outside of an ncurses application, or escape sequences emitted by an ncurses application via init_color(). Some popular color schemes, most notably Solarized, define colors in a way that they really don't resemble the traditional colors. There's absolutely no guarantee, it's just a convention that most likely COLOR_YELLOW will result in a yellow-ish or brown-ish color.

The best to think about these constants such as COLOR_YELLOW as "the color slot that usually, but not necessarily, is defined to a yellow-ish color".

You can easily query the number of available colors in ncurses (you'll get 256 in most graphical terminals nowadays), and use any index up to that limit. Use the indices 8-15 to get the brighter colors. (And combine any color with A_BOLD if and only if you actually want bold.)


Note You need to log in before you can comment on or make changes to this bug.