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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.gui.colorscheme</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.gui.html"><font color="#ffffff">gui</font></a>.colorscheme</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/gui/colorscheme.py">/home/hut/work/ranger/ranger/gui/colorscheme.py</a></font></td></tr></table>
<p><tt>Colorschemes define colors for specific contexts.<br>
<br>
Generally, this works by passing a set of keywords (strings) to<br>
the colorscheme.get() method to receive the tuple (fg, bg, attr).<br>
fg, bg are the foreground and background colors and attr is the attribute.<br>
The values are specified in ranger.gui.color.<br>
<br>
A colorscheme must...<br>
<br>
1. be inside either of these directories:<br>
~/.ranger/colorschemes/<br>
path/to/ranger/colorschemes/<br>
<br>
2. be a subclass of ranger.gui.colorscheme.<a href="#ColorScheme">ColorScheme</a><br>
<br>
3. implement a use(self, context) method which returns (fg, bg, attr).<br>
context is a struct which contains all entries of CONTEXT_KEYS,<br>
associated with either True or False.<br>
<br>
define which colorscheme to use by having this to your options.py:<br>
from ranger import colorschemes<br>
colorscheme = colorschemes.filename<br>
<br>
If your colorscheme-file contains more than one colorscheme, specify it with:<br>
colorscheme = colorschemes.filename.classname</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.gui.colorscheme.html#ColorScheme">ColorScheme</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="ColorScheme">class <strong>ColorScheme</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>This is the class that colorschemes must inherit from.<br>
<br>
it defines <a href="#ColorScheme-get">get</a>() <br>
it defines the <a href="#ColorScheme-get">get</a>() method, which returns the color tuple<br>
which fits to the given keys.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ColorScheme-__init__"><strong>__init__</strong></a>(self)</dt></dl>
<dl><dt><a name="ColorScheme-get"><strong>get</strong></a>(self, *keys)</dt><dd><tt>Returns the (fg, bg, attr) for the given keys.<br>
<br>
Using this function rather than <a href="#ColorScheme-use">use</a>() will cache all<br>
colors for faster access.</tt></dd></dl>
<dl><dt><a name="ColorScheme-get_attr"><strong>get_attr</strong></a>(self, *keys)</dt><dd><tt>Returns the curses attribute for the specified keys<br>
<br>
Ready to use for curses.setattr()</tt></dd></dl>
<dl><dt><a name="ColorScheme-use"><strong>use</strong></a>(self, context)</dt><dd><tt>Use the colorscheme to determine the (fg, bg, attr) tuple.<br>
This is a dummy function which always returns default_colors.<br>
Override this in your custom colorscheme!</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>CONTEXT_KEYS</strong> = ['reset', 'error', 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console', 'in_pager', 'in_taskview', 'directory', 'file', 'hostname', 'executable', 'media', 'link', 'video', 'audio', 'image', 'media', 'document', 'container', ...]</td></tr></table>
</body></html>
|