Ubuntu – Customizing terminal tab color in Ubuntu 17.10

gnomegnome-terminalgtkthemes

By default it looks like this:

enter image description here

I don't like it and want it to be dark, so I add this to my ~/.config/gtk-3.0/gtk.css:

terminal-window notebook tab {
    background-image: -gtk-gradient (linear, left top, left bottom,
                                     from (shade (@fg_color, 0.92)),
                                     color-stop (0.60, shade (@fg_color, 0.9)),
                                     to (shade (@fg_color, 0.85)));
    color: @bg_color;
}

terminal-window notebook tab:active {
    background-image: -gtk-gradient (linear, left top, left bottom,
                                    from (shade (@dark_bg_color, 1.2)),
                                    to (shade (@dark_bg_color, 1.12)));

   -unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 1.0);
}

The result is:

enter image description here

Which is better, but active tab is not highlighted.

My reference is http://bazaar.launchpad.net/~maxb/ubuntu/trusty/ubuntu-themes/colours/view/head:/Ambiance/gtk-3.0/apps/gnome-terminal.css, but TerminalWindow .notebook tab selector does not have effect, so I changed it to terminal-window notebook tab (inspired by https://github.com/horst3180/arc-theme/blob/master/common/gtk-3.0/3.20/gtk.css#L3017, not sure why this difference in selector exists?) and it worked, but not with :active selector.

Any idea why this difference in selectors and why :active does not work?

Thanks!

Best Answer

You can use the following style to get tab working:

/* gnome-terminal */
@define-color terminal_bg #300a24;
@define-color bg_color_active_tab #157bb7;


notebook.terminal-notebook header.top tab,
notebook.terminal-notebook header.top tab:hover {
    background-image: -gtk-gradient (linear, left top, left bottom,
                                    from (shade (@fg_color, 0.92)),
                                    color-stop (0.60, shade (@fg_color, 0.9)),
                                    to (shade (@fg_color, 0.85)));
    color: @bg_color;
}

notebook.terminal-notebook header.top tab:checked {
    background-image: -gtk-gradient (linear, left top, left bottom,
                    from (shade (@bg_color_active_tab, 1.2)),
                    to (shade (@bg_color_active_tab, 1.12)));
    color: @bg_color;

}

This will result in:

screenshot with highlighted tab

Related Question