How to change the color of the scroll bar?
Solution 1
A bit late, but perhaps I've found a quite nice, easy GUI solution:
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 :)
Solution 2
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:
Solution 3
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.
Solution 4
Found the solution: sudo and open /usr/share/themes/Ambiance/gtk-2.0/gtkrc
and find this code:
style "scrollbar" = "button" {
Below in the curly braces, change the bg[SOMETHING] lines to look like:
bg[NORMAL] = @selected_bg_color
bg[PRELIGHT] = shade (1.04, @selected_bg_color)
bg[ACTIVE] = shade (0.96, @selected_bg_color)
Or look at the colors declared in line 1 of the file and select the one you prefer. To update the looks, in System settings/Appearance, change the theme to another one and back to Ambiance.
edit: Appears that Xterm uses Radiance theme. Scrollbars in Radiance are black on black and are just invisible. So stylish, yeah! Need to do edit that theme too.
Solution 5
Although not a direct answer to the question, if you dislike the new scrollbars (I don't blame you, they are quite horrendous in my personal opinion), you can revert to standard scrollbars by running the following command:
sudo apt-get remove overlay-scrollbar liboverlay-scrollbar3-0.2-0 liboverlay-scrollbar-0.2-0
Related videos on Youtube
Konstantin Kudryavtsev
Updated on September 18, 2022Comments
-
Konstantin Kudryavtsev over 1 year
The scrollbars in Unity are of very low contrast, and I can't see where the bar is using just peripheral vision. I have to look at the scrollbar.
Look at Mac OS X interface and notice the blue, contrasting scroll bar. You don't need to look at it directly to have the idea where you are in the page.
How can I change it so that it has more contrast and I see where I am every time?
-
Sanam Patel over 12 years@culebrón here's your screenshot with a radial blur and 'invisible' scroll bar. I'll let you add it to your question if you want.
-
Bruno Pereira about 12 years@culebrón could this question possibly be the issue you are facing?
-
Knowledge Cube about 12 yearsRelated bug report: Bug #563474
-
neuronet over 7 yearsSuggesting the non-appropriate question for SE sites: Why did the developers think such a low contrast scrollbar was good UI?
-
-
nilsonneto over 12 yearsPlease can you file a bug report to notify the developers - we need the scrollbar color configurable and your use-case will highlight this. thanks.
-
Admin over 12 yearsIt's possible that the OP is concerned with the conventional scrollbars and not the overlay-scrollbar since editing
/usr/share/themes/Ambiance/gtk-2.0/gtkrc
helped. -
Admin over 12 years@fossfreedom, I think you could edit out the "Unity" from "Unity scroll-bar" since I think the OP is referring to the conventional scrollbars (gtk-2.0) that we see in LibreOffice and Firefox, for example. Leaving "Unity" in place may give the impression that it's the "new" overlay scrollbars being talked about.
-
nilsonneto over 12 years@vasa1 - I'll let the OP answer this one...
-
Konstantin Kudryavtsev over 12 yearsI'm okay with them, they look stylish, but the "stylish" thing is obviously overdone here, at the cost of usability. The same goes for the fashion of writing in all small letters or all caps, "ubuntu". The less sticks are sticking out of the line, the worse is readability.
-
Jorge Castro almost 12 yearsIt might be a better idea to make this modification in a user's directory instead of systemwide
-
adarshr over 11 yearsFor some reason, doing this doesn't affect terminal scrollbars at all. I even fiddled around in
/usr/share/themes/Ambiance/gtk-2.0/apps/gnome-terminal.rc
but no joy! -
askuhn over 11 yearsSorry adarshr, but I'm not familiar enough with themeing to help you with the Terminal's scrollbars. Hopefully someone else can jump in with a solution. :)
-
MestreLion about 11 yearsQuestion is obviously about the conventional (or "legacy") scrollbar, since that's the one with poor contrast. You may or may not like the new overlay style, but its thin orange over gray at least has proper contrast.
-
yoyoma2 almost 8 yearsThis works great for gtk3 apps like firefox 46 and above. Instead of modifying the original theme files, the changes can be added to ~/.config/gtk-3.0/gtk.css giving each user their own preferred look while preserving the originals.
-
neuronet over 7 yearsTried this in Unity Ubuntu 14.04 it had no effect on my scrollbars that I've noticed so far (including after restart).
-
MestreLion over 7 years@neuronet: Yes, I've noticed this stopped working in recent versions of Firefox (from 45 or 47)
-
neuronet over 7 yearsWhy the bleep can't Unity developers just make this a conspicuous part of system settings? The amount of time I've been annoyed about this I could have developed a new OS. :)