#!/usr/bin/python
# coding=utf-8
#
# Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import ranger
from optparse import OptionParser, SUPPRESS_HELP
from ranger.ext.openstruct import OpenStruct
from ranger import __version__, USAGE, DEFAULT_CONFDIR
import ranger.api.commands
from signal import signal, SIGINT
from locale import getdefaultlocale, setlocale, LC_ALL
from ranger.ext import curses_#!/usr/bin/env python
"""
You can use this tool to display all supported colors and their color number.
It will exit after a keypress.
"""
from __future__ import (absolute_import, division, print_function)
import curses
@curses.wrapper
def main(win):
def print_all_colors(attr):
for color in range(-1, curses.COLORS):
try:
curses.init_pair(color, color, 0)
except curses.error:
pass
else:
win.addstr(str(color) + ' ', curses.color_pair(color) | attr)
curses.start_color()
try:
curses.use_default_colors()
except curses.error:
pass
win.addstr("available colors: %d\n\n" % curses.COLORS)
print_all_colors(0)
win.addstr("\n\n")
print_all_colors(curses.A_BOLD)
win.refresh()
win.getch()