comparison mercurial/color.py @ 30968:0d2a58a04080

color: move '_terminfo_params' into the core 'color' module On step closer to have color in core.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2016 02:23:23 +0100
parents 20990991d384
children ddc80d1777a6
comparison
equal deleted inserted replaced
30967:20990991d384 30968:0d2a58a04080
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9
10 try:
11 import curses
12 # Mapping from effect name to terminfo attribute name (or raw code) or
13 # color number. This will also force-load the curses module.
14 _terminfo_params = {'none': (True, 'sgr0', ''),
15 'standout': (True, 'smso', ''),
16 'underline': (True, 'smul', ''),
17 'reverse': (True, 'rev', ''),
18 'inverse': (True, 'rev', ''),
19 'blink': (True, 'blink', ''),
20 'dim': (True, 'dim', ''),
21 'bold': (True, 'bold', ''),
22 'invisible': (True, 'invis', ''),
23 'italic': (True, 'sitm', ''),
24 'black': (False, curses.COLOR_BLACK, ''),
25 'red': (False, curses.COLOR_RED, ''),
26 'green': (False, curses.COLOR_GREEN, ''),
27 'yellow': (False, curses.COLOR_YELLOW, ''),
28 'blue': (False, curses.COLOR_BLUE, ''),
29 'magenta': (False, curses.COLOR_MAGENTA, ''),
30 'cyan': (False, curses.COLOR_CYAN, ''),
31 'white': (False, curses.COLOR_WHITE, '')}
32 except ImportError:
33 curses = None
34 _terminfo_params = {}
9 35
10 # start and stop parameters for effects 36 # start and stop parameters for effects
11 _effects = {'none': 0, 37 _effects = {'none': 0,
12 'black': 30, 38 'black': 30,
13 'red': 31, 39 'red': 31,