Document how to install and enable a colorscheme
I've read https://github.com/ranger/ranger/blob/master/doc/colorschemes.txt and understood nothing. Docs should start from simple stuff, I don't want to immediately learn about 'context tags', 'Implementation in the GUI Classes' and subclasses of whatever prior to learning how to apply a custom colorscheme.
Colorschemes are searched for in these directories: ~/.config/ranger/colorschemes/ /path/to/ranger/colorschemes/
Uh, how do colorscheme files look like? Provide an example, please. I've googled myself this one, but it crashes ranger with AttributeError: 'Context' object has no attribute 'frozen'. Luckily, that didn't stop me from trying another colorscheme from that repo that doesn't crash ranger.
To specify which colorscheme to use, change the option "colorscheme" in your rc.conf:
I don't have an rc.conf, the docs don't even mention its location. I doubt that you meant /etc/rc.conf.
The docs should be as simple as that:
mkdir -p ~/.config/ranger/colorschemes/ # create a dir for colorschemes
mv some_colorscheme.py ~/.config/ranger/colorschemes/myscheme.py # import colorscheme file
echo 'set colorscheme myscheme' >> ~/.config/ranger/rc.conf # apply imported colorscheme on startup via ranger's config
Not sure why you closed this. It's a valid complaint. The file you found is more for people who want to implement a colorscheme than use one. None of the maintainers seem to use colorschemes so it's fairly low priority for us.
This is the bare minimum that should get you going:
ranger --copy-config=rc
mkdir ~/.config/ranger/colorschemes
# Download some colorscheme into ~/.config/ranger/colorschemes, dotshare.it has some (link is on the wiki)
# Edit ~/.config/ranger/rc.conf so it sets your colorscheme
Feel free to contribute a wiki page or a getting started section to the docs : )
sorry, but applying the steps doesnt work.
the theme its not loading into ranger. even if its located under colorschemes folder and even if the rc.conf contains set colorscheme myscheme.
any thoughts? thanks.
Is myscheme the proper name? And is the colorscheme actually compatible with ranger? Try copying and rename an included colorscheme to see if that works first maybe.
i've tried many ways, but doesnt work.
what i tried you can see here: https://github.com/ninjabreakbot/ranger-gruvbox/issues/1
Hmm, are you running ranger with sudo? Cause then it won't pick up your user config. If you put the colorscheme in /usr/share you should be able to set it while running ranger as root though.
im not running as sudo. currently i have the theme in ~/.config/ranger/colorschemes.
but i tried putting it globally. i tried overwriting it with the default one, doesnt work.
what am i missing?
Is ranger actually reading from that config directory? Maybe you have XDG_CONFIG_HOME set to something else?
its set to ~/.config/ and ranger is reading from it because image preview doest work for me and the setting for that is located in $XDG_CONFIG_HOME/ranger
One thing is that you need to issue a :reset/press <c-r> after setting a colorscheme. The other thing is that the Gruvbox theme is really similar to the default theme, so maybe you're just not noticing the difference?
As a test to see if the theme is being picked up at all by ranger you can enter :set colorscheme then press <Tab> a couple times to see if it completes gruvbox.
maybe you are right. maybe it is the same as default. because i tried other default schemes such as snow, and that worked.
and, i, ofc, restarted ranger after every change.
To verify you can add return green, bg, attr in the "use" function of the colorscheme (somewhere before the existing return of course) and then check whether everything looks green.
Do note that it is not the same, it's just very similar.
yea but, its so similar in a way that when i change from default to gruvbox, it looks the same.
I had some difficulty changing the color of the active item highlight, so I figured I'd leave my solution here (I imagine this is a common use case for changing color scheme).
from __future__ import (absolute_import, division, print_function)
from ranger.colorschemes.default import Default
from ranger.gui.color import blue, yellow, BRIGHT
class Scheme(Default):
def use(self, ctx):
fg, bg, attr = super().use(ctx)
# replace selection highlight with yellow
if fg == blue + BRIGHT:
fg = yellow
return fg, bg, attr
@superhawk610, this'll of course replace any element with a blue foreground color. If you just want to change the color of the selected item you can use:
if context.selected: # Might want to add "and context.main_column"
fg = yellow
The issue is more than 4 years old now, and I don't find any good documentation about the colorschemes. The link in the issue post is also dead. Is there any progress?
I want to contribute to the documentation but I can't find a starting point. Is there any?
New link is https://github.com/ranger/ranger/blob/master/doc/colorschemes.md
@shasherazi, if you're still interested. The best place to get started would probably be the wiki, maybe as part of the User Guide. colorschemes.md is developer documentation, not user documentation, it does not need to be improved for users (though it could definitely stand to be improved for developers).
Also note that we'd like to focus colorscheme development in the colorschemes repo. Expanding the README there would also be a good way to go about it.
Probably useful info:
I have ranger running gruvbox. The colorscheme for ranger is default. However, the color theme for my terminal (Konsole) is gruvbox. I also confirmed that changing colorscheme overrides Konsole's, but default actually inherits it.
Whether or not colorschemes override the terminal's scheme depends on whether they use the 16 base colors or not. Most of the included colorschemes with Ranger do so. Solarized is an exception.