summary refs log tree commit diff stats
path: root/doc/tools
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-03-09 18:50:18 +0100
committerhut <hut@lavabit.com>2013-03-09 18:50:39 +0100
commit6c5f7d73bc634be4b566f041ff12c6d481fb4207 (patch)
tree4260c8623bcee8f80576eb815a07dee138da963f /doc/tools
parentd2c7d024290ee95afa418975c728ad64172dcfec (diff)
downloadranger-6c5f7d73bc634be4b566f041ff12c6d481fb4207.tar.gz
move doc/print_{colors,keys}.py to doc/tools/
Diffstat (limited to 'doc/tools')
-rwxr-xr-xdoc/tools/print_colors.py23
-rwxr-xr-xdoc/tools/print_keys.py14
2 files changed, 37 insertions, 0 deletions
diff --git a/doc/tools/print_colors.py b/doc/tools/print_colors.py
new file mode 100755
index 00000000..ce040b33
--- /dev/null
+++ b/doc/tools/print_colors.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+"""
+You can use this tool to display all supported colors and their color number.
+It will exit after a keypress.
+"""
+
+import curses
+from curses import *
+
+@wrapper
+def main(win):
+    def print_all_colors(attr):
+        for c in range(0, curses.COLORS):
+            init_pair(c, c, -1)
+            win.addstr(str(c) + ' ', color_pair(c) | attr)
+    use_default_colors()
+    win.addstr("available colors: %d\n\n" % curses.COLORS)
+    print_all_colors(0)
+    win.addstr("\n\n")
+    print_all_colors(A_BOLD)
+    win.refresh()
+    win.getch()
+
diff --git a/doc/tools/print_keys.py b/doc/tools/print_keys.py
new file mode 100755
index 00000000..17d2513b
--- /dev/null
+++ b/doc/tools/print_keys.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+"""
+You can use this tool to find out values of keypresses
+"""
+
+from curses import *
+
+sep = '; '
+
+@wrapper
+def main(w):
+    while True:
+        w.addstr(str(w.getch()) + sep)
+