How to change the color of the scroll bar?
A bit late, but perhaps I've found a quite nice, easy GUI solution:
gnome-color-chooser
Highlights:
- Completely GUI solution, no need to manually fiddle with
~/.gtkrc
- Only changes the settings you check. Uncheck them revert to default.
- Changes are applied as soon as you click
Apply
. No need to switch themes back and forth - No need of sudo (but changes are to your user only)
- Applies to "legacy" scrollbars only (the ones that need to be fixed). The "overlay" scrollbar is not modified.
The changes are quite unobtrusive: it edits (or creates) ~/.gtkrc
to include its own config file:
include ".gtkrc-2.0-gnome-color-chooser"
And that file is pretty slim too:
style "gnome-color-chooser-scrollbar"
{
bg[NORMAL] = "#ACACAC"
bg[PRELIGHT] = "#808080"
bg[ACTIVE] = "#ACACAC"
}
widget_class "*Scrollbar" style "gnome-color-chooser-scrollbar"
Btw, I've picked the above colors out of experiments. They blend in nicely with Ambiance's "monochrome-ish" style, being just a bit darker (and thus more visible) than default.
Until Firefox gets overlay scrollbars, I'm quite happy with my custom colors :)
I built upon what culebrón described and accidentally created something I think is pretty awesome...
Open /usr/share/themes/Ambiance/gtk-2.0/gtkrc
as root for modification:
gksu gedit /usr/share/themes/Ambiance/gtk-2.0/gtkrc
Then modify the matching section in that file to the following (remember to back up the defaults in case you don't like the changes):
style "scrollbar" = "button" {
xthickness = 2
ythickness = 2
bg[NORMAL] = shade (0.62, @bg_color)
bg[PRELIGHT] = shade (0.66, @bg_color)
bg[ACTIVE] = shade (0.64, @bg_color)
engine "murrine"
{
border_shades = {0.95, 0.90}
roundness = 3
contrast = 1.0
trough_shades = {0.92, 0.98}
lightborder_shade = 1.3
glowstyle = 5
glow_shade = 1.02
gradient_shades = {1.2, 1.0, 1.0, 0.86}
trough_border_shades = {0.9, 0.98}
}
}
Save, then apply the changes by toggling themes or logging out.
The new, awesome, and usable scrollbars might look like:
The above changes the scroll bar for applications that use the gtk2 theme files. So does the gnome-color-chooser, (atleast the one in the current repository). For gtk3 applications, like gnome-terminal and gedit in 13.04 using gnome-fallback, one needs to change /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css
.
To do this
sudo gedit /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css
and replace the * scrollbar *
section with this:
/*************
* scrollbar *
*************/
.scrollbar,
.scrollbar.vertical {
-GtkScrollbar-has-backward-stepper: 0;
-GtkScrollbar-has-forward-stepper: 0;
-GtkRange-slider-width: 14;
border-radius: 3px;
border-image: none;
}
.scrollbar.trough,
.scrollbar.trough.vertical {
border-color: shade (@bg_color, 0.64);
}
.scrollbar.trough.horizontal {
}
.scrollbar.slider,
.scrollbar.slider:hover,
.scrollbar.button,
.scrollbar.slider.vertical,
.scrollbar.slider.vertical:hover,
.scrollbar.button.vertical {
border-width: 1px;
border-style: solid;
border-color: shade (@bg_color, 0.4);
background-image: -gtk-gradient (linear, left top, right top,
from (shade (@button_bg_color, 0.76)),
to (shade (@button_bg_color, 0.62)));
box-shadow: inset 1px 0 shade (@button_bg_color, 0.85),
inset -1px 0 shade (@button_bg_color, 0.62),
inset 0 1px shade (@button_bg_color, 0.9),
inset 0 -1px shade (@button_bg_color, 0.62);
}
.scrollbar.slider.horizontal,
.scrollbar.slider.horizontal:hover,
.scrollbar.button.horizontal {
background-image: -gtk-gradient (linear, left top, left bottom,
from (shade (@button_bg_color, 0.76)),
to (shade (@button_bg_color, 0.62)));
box-shadow: inset 1px 0 shade (@button_bg_color, 0.85),
inset -1px 0 shade (@button_bg_color, 0.62),
inset 0 1px shade (@button_bg_color, 0.9),
inset 0 -1px shade (@button_bg_color, 0.62);
}
.scrollbar.button,
.scrollbar.button:insensitive {
}
This gives a scrollbar in gtk3 that looks like this:
Which is kinda similiar to the one for gtk2 above. The small ticks and proper steppers is not included here though.