author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
Thu, 22 Dec 2016 02:26:50 +0100 | |
changeset 30989 | ddc80d1777a6 |
parent 30988 | 0d2a58a04080 |
child 30990 | 683606a829e8 |
permissions | -rw-r--r-- |
30656
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
1 |
# utility for color output for Mercurial commands |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
2 |
# |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
3 |
# Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com> and other |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
4 |
# |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
6 |
# GNU General Public License version 2 or any later version. |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
7 |
|
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
8 |
from __future__ import absolute_import |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
9 |
|
30988
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
10 |
try: |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
11 |
import curses |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
12 |
# Mapping from effect name to terminfo attribute name (or raw code) or |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
13 |
# color number. This will also force-load the curses module. |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
14 |
_terminfo_params = {'none': (True, 'sgr0', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
15 |
'standout': (True, 'smso', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
16 |
'underline': (True, 'smul', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
17 |
'reverse': (True, 'rev', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
18 |
'inverse': (True, 'rev', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
19 |
'blink': (True, 'blink', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
20 |
'dim': (True, 'dim', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
21 |
'bold': (True, 'bold', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
22 |
'invisible': (True, 'invis', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
23 |
'italic': (True, 'sitm', ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
24 |
'black': (False, curses.COLOR_BLACK, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
25 |
'red': (False, curses.COLOR_RED, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
26 |
'green': (False, curses.COLOR_GREEN, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
27 |
'yellow': (False, curses.COLOR_YELLOW, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
28 |
'blue': (False, curses.COLOR_BLUE, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
29 |
'magenta': (False, curses.COLOR_MAGENTA, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
30 |
'cyan': (False, curses.COLOR_CYAN, ''), |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
31 |
'white': (False, curses.COLOR_WHITE, '')} |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
32 |
except ImportError: |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
33 |
curses = None |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
34 |
_terminfo_params = {} |
0d2a58a04080
color: move '_terminfo_params' into the core 'color' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30987
diff
changeset
|
35 |
|
30987
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
36 |
# start and stop parameters for effects |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
37 |
_effects = {'none': 0, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
38 |
'black': 30, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
39 |
'red': 31, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
40 |
'green': 32, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
41 |
'yellow': 33, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
42 |
'blue': 34, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
43 |
'magenta': 35, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
44 |
'cyan': 36, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
45 |
'white': 37, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
46 |
'bold': 1, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
47 |
'italic': 3, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
48 |
'underline': 4, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
49 |
'inverse': 7, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
50 |
'dim': 2, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
51 |
'black_background': 40, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
52 |
'red_background': 41, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
53 |
'green_background': 42, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
54 |
'yellow_background': 43, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
55 |
'blue_background': 44, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
56 |
'purple_background': 45, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
57 |
'cyan_background': 46, |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
58 |
'white_background': 47} |
20990991d384
color: move '_effect' mapping into core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30657
diff
changeset
|
59 |
|
30656
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
60 |
_styles = {'grep.match': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
61 |
'grep.linenumber': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
62 |
'grep.rev': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
63 |
'grep.change': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
64 |
'grep.sep': 'cyan', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
65 |
'grep.filename': 'magenta', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
66 |
'grep.user': 'magenta', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
67 |
'grep.date': 'magenta', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
68 |
'bookmarks.active': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
69 |
'branches.active': 'none', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
70 |
'branches.closed': 'black bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
71 |
'branches.current': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
72 |
'branches.inactive': 'none', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
73 |
'diff.changed': 'white', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
74 |
'diff.deleted': 'red', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
75 |
'diff.diffline': 'bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
76 |
'diff.extended': 'cyan bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
77 |
'diff.file_a': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
78 |
'diff.file_b': 'green bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
79 |
'diff.hunk': 'magenta', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
80 |
'diff.inserted': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
81 |
'diff.tab': '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
82 |
'diff.trailingwhitespace': 'bold red_background', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
83 |
'changeset.public' : '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
84 |
'changeset.draft' : '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
85 |
'changeset.secret' : '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
86 |
'diffstat.deleted': 'red', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
87 |
'diffstat.inserted': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
88 |
'histedit.remaining': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
89 |
'ui.prompt': 'yellow', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
90 |
'log.changeset': 'yellow', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
91 |
'patchbomb.finalsummary': '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
92 |
'patchbomb.from': 'magenta', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
93 |
'patchbomb.to': 'cyan', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
94 |
'patchbomb.subject': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
95 |
'patchbomb.diffstats': '', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
96 |
'rebase.rebased': 'blue', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
97 |
'rebase.remaining': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
98 |
'resolve.resolved': 'green bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
99 |
'resolve.unresolved': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
100 |
'shelve.age': 'cyan', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
101 |
'shelve.newest': 'green bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
102 |
'shelve.name': 'blue bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
103 |
'status.added': 'green bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
104 |
'status.clean': 'none', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
105 |
'status.copied': 'none', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
106 |
'status.deleted': 'cyan bold underline', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
107 |
'status.ignored': 'black bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
108 |
'status.modified': 'blue bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
109 |
'status.removed': 'red bold', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
110 |
'status.unknown': 'magenta bold underline', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
111 |
'tags.normal': 'green', |
1ec42bdd7874
color: move hgext.color._styles to mercurial.color.style
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
112 |
'tags.local': 'black bold'} |
30657
b2be4ccaff1d
color: load 'colortable' from extension using an 'extraloader'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30656
diff
changeset
|
113 |
|
b2be4ccaff1d
color: load 'colortable' from extension using an 'extraloader'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30656
diff
changeset
|
114 |
def loadcolortable(ui, extname, colortable): |
b2be4ccaff1d
color: load 'colortable' from extension using an 'extraloader'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30656
diff
changeset
|
115 |
_styles.update(colortable) |
30989
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
116 |
|
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
117 |
def valideffect(effect): |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
118 |
'Determine if the effect is valid or not.' |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
119 |
good = False |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
120 |
if not _terminfo_params and effect in _effects: |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
121 |
good = True |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
122 |
elif (effect in _terminfo_params |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
123 |
or effect[:-11] in _terminfo_params): |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
124 |
good = True |
ddc80d1777a6
color: move 'valideffect' function into the core module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30988
diff
changeset
|
125 |
return good |