guest@dotshare [~/groups/fms/ranger] $ ls Classy-Touch/ | cat

Classy Touch (scrot) (+7 likes)

Graawr Jun 27, 2013 (fms/ranger)

colorscheme(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
from ranger.gui.colorscheme import ColorScheme
from ranger.gui.color import *

class Default(ColorScheme):
	def use(self, context):
		fg, bg, attr = default_colors

		if context.reset:
			return default_colors

		elif context.in_browser:
			if context.selected:
				fg = white
				attr = bold
			else:
				attr = normal
			if context.empty or context.error:
				fg = black
			if context.border:
				attr = normal
				fg = black
			if context.media:
				if context.image:
					fg = black
				else:
					fg = white
			if context.container:
				attr |= normal
				fg = green
			if context.directory:
				attr |= normal
				fg = red
			elif context.executable and not \
					any((context.media, context.container,
						context.fifo, context.socket)):
				attr |= normal
				fg = red
			if context.socket:
				fg = red
			if context.fifo or context.device:
				fg = yellow
				if context.device:
					attr |= bold
			if context.link:
				fg = context.good and white or red
			if context.tag_marker and not context.selected:
				attr |= bold
				if fg in (red, white):
					fg = black
				else:
					fg = green
			if not context.selected and (context.cut or context.copied):
				fg = white
				attr |= bold
			if context.main_column:
				if context.selected:
					attr |= normal
				if context.marked:
					attr |= underline
					fg = white
			if context.badinfo:
				if attr & reverse:
					bg = red
				else:
					fg = red

		elif context.in_titlebar:
			attr |= normal
			if context.hostname:
				attr |= normal
				fg = red
			elif context.directory:
				fg = red
			elif context.tab:
				if context.good:
					bg = green
			elif context.link:
				fg = magenta

		elif context.in_statusbar:
			if context.permissions:
				if context.good:
					fg = black
				elif context.bad:
					fg = red
			if context.marked:
				attr |= bold | reverse
				fg = yellow
			if context.message:
				if context.bad:
					attr |= bold
					fg = red

		if context.text:
			if context.highlight:
				attr |= bold

		if context.in_taskview:
			if context.title:
				fg = red

			if context.selected:
				attr |= normal

		return fg, bg, attr

CLICK TO VIEW

x

options.py(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011  Roman Zimbelmann <romanz@lavabit.com>
# This configuration file is licensed under the same terms as ranger.
# ===================================================================
# This is the main configuration file of ranger.  It consists of python
# code, but fear not, you don't need any python knowledge for changing
# the settings.
#
# Lines beginning with # are comments.  To enable a line, remove the #.
#
# You can customize ranger in the file ~/.config/ranger/options.py.
# It has the same syntax as this file.  In fact, you can just copy this
# file there with `ranger --copy-config=options' and make your modifications.
# But make sure you update your configs when you update ranger.
# ===================================================================

from ranger.api.options import *

# Load the deault rc.conf file?  If you've copied it to your configuration
# direcory, then you should deactivate this option.
load_default_rc = True

# How many columns are there, and what are their relative widths?
column_ratios = (5, 2)

# Which files should be hidden?  Toggle this by typing `zh' or
# changing the setting `show_hidden'
hidden_filter = regexp(
	r'^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$')
show_hidden = False

# Which script is used to generate file previews?
# ranger ships with scope.sh, a script that calls external programs (see
# README for dependencies) to preview images, archives, etc.
preview_script = '~/.config/ranger/scope.sh'

# Use that external preview script or display internal plain text previews?
use_preview_script = True

# Use a unicode "..." character to mark cut-off filenames?
unicode_ellipsis = True

# Show dotfiles in the bookmark preview box?
show_hidden_bookmarks = True

# Which colorscheme to use?  These colorschemes are available by default:
# default, default88, jungle, snow
# Snow is monochrome and default88 uses 88 colors.
colorscheme = 'classytouch'

# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
preview_files = True
preview_directories = True
collapse_preview = True

# Save the console history on exit?
save_console_history = True

# Draw borders around columns?
draw_borders = True
draw_bookmark_borders = True

# Display the directory name in tabs?
dirname_in_tabs = False

# Enable the mouse support?
mouse_enabled = False

# Display the file size in the main column or status bar?
display_size_in_main_column = True
display_size_in_status_bar = False

# Display files tags in all columns or only in main column?
display_tags_in_all_columns = False

# Set a title for the window?
update_title = True

# Shorten the title if it gets long?  The number defines how many
# directories are displayed at once, False turns off this feature.
shorten_title = 3

# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
tilde_in_titlebar = False

# How many directory-changes or console-commands should be kept in history?
max_history_size = 20
max_console_history_size = 50

# Try to keep so much space between the top/bottom border when scrolling:
scroll_offset = 8

# Flush the input after each key hit?  (Noticable when ranger lags)
flushinput = True

# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
padding_right = False

# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
autosave_bookmarks = True

# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc".  The size is expensive to
# calculate and will not be updated automatically.  You can choose
# to update it automatically though by turning on this option:
autoupdate_cumulative_size = False

# Makes sense for screen readers:
show_cursor = False

# One of: size, basename, mtime, type
sort = 'natural'
sort_reverse = False
sort_case_insensitive = True
sort_directories_first = True

# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
xterm_alt_key = False

# A function that is called when the user interface is being set up.
init_function = None

# You can use it to initialize some custom functionality or bind singals
#def init_function(fm):
#	fm.notify("Hello :)")
#	def on_tab_change(signal):
#		signal.origin.notify("Changing tab! Yay!")
#	fm.signal_bind("tab.change", on_tab_change)

# The color scheme overlay.  Explained below.
colorscheme_overlay = None

## Apply an overlay function to the colorscheme.  It will be called with
## 4 arguments: the context and the 3 values (fg, bg, attr) returned by
## the original use() function of your colorscheme.  The return value
## must be a 3-tuple of (fg, bg, attr).
## Note: Here, the colors/attributes aren't directly imported into
## the namespace but have to be accessed with color.xyz.

#from ranger.gui import color
#def colorscheme_overlay(context, fg, bg, attr):
#	if context.directory and attr & color.bold and \
#			not any((context.marked, context.selected)):
#		attr ^= color.bold  # I don't like bold directories!
#
#	if context.main_column and context.selected:
#		fg, bg = color.red, color.default  # To highlight the main column!
#
#	return fg, bg, attr


# ===================================================================
# Beware: from here on, you are on your own.  This part requires python
# knowledge.
#
# Since python is a dynamic language, it gives you the power to replace any
# part of ranger without touching the code.  This is commonly referred to as
# Monkey Patching and can be helpful if you, for some reason, don't want to
# modify rangers code directly.  Just remember: the more you mess around, the
# more likely it is to break when you switch to another version.
#
# Here are some practical examples of monkey patching.
#
# Technical information:  This file is imported as a python module.  If a
# variable has the name of a setting, ranger will attempt to use it to change
# that setting.  You can write "del <variable-name>" to avoid that.
# ===================================================================
# Add a new sorting algorithm: Random sort.
# Enable this with :set sort=random

#from ranger.fsobject.directory import Directory
#from random import random
#Directory.sort_dict['random'] = lambda path: random()

# ===================================================================
# A function that changes which files are displayed.  This is more powerful
# than the hidden_filter setting since this function has more information.

## Save the original filter function
#import ranger.fsobject.directory
#old_accept_file = ranger.fsobject.directory.accept_file
#
## Define a new one
#def accept_file_MOD(fname, mypath, hidden_filter, name_filter):
#	if hidden_filter and mypath == '/' and fname in ('boot', 'sbin', 'proc', 'sys'):
#		return False
#	else:
#		return old_accept_file(fname, mypath, hidden_filter, name_filter)
#
## Overwrite the old function
#import ranger.fsobject.directory
#ranger.fsobject.directory.accept_file = accept_file_MOD

# ===================================================================
# A function that adds an additional macro.  Test this with :shell -p echo %date

## Save the original macro function
#import ranger.core.actions
#old_get_macros = ranger.core.actions.Actions._get_macros
#
## Define a new macro function
#import time
#def get_macros_MOD(self):
#	macros = old_get_macros(self)
#	macros['date'] = time.strftime('%m/%d/%Y')
#	return macros
#
## Overwrite the old one
#ranger.core.actions.Actions._get_macros = get_macros_MOD
 

x

Comments

kyzys said about 11 years ago

First off, I love all of your work on Classy Touch, I use many of your configs as a base. I am just wondering how I apply these settings to ranger in an Arch Linux system. Thanks.

Graawr said about 11 years ago

Hi :)
You need to put this file in ~/.config/ranger/colorschemes/classytouch.py, and set the colorscheme to “classytouch” in your ~/.config/ranger/options.py .
I’ll upload the main ranger config file on the morrow if you need it, ‘cause this file here only gives you the colorscheme, though the rest of the config is fairly classic.

Note that the final output may still be different though because this shot comes from a debian wheezy ranger; there has been at least one major version since then and it seems the interface have slightly changed; the config files have changed as well, so I’m not even sure if you still set the colorscheme in options.py but if not, you should quickly find your way in the two or three remaining choices.

kyzys said about 11 years ago

Thank you! I will try it out when I get to my laptop next. I would love to have the main config too and see what I can do with it. I appreciate it.

Graawr said about 11 years ago

Sorry for the delay. I just added the options.py file. As I said it’s not compatible with the arch version of ranger but if you still take it, ranger will tell you how to adapt it for your version upon startup.

kyzys said about 11 years ago

Edit: nevermind got it to work easily, thank you.

edited about 11 years ago