diff mercurial/color.py @ 30989:ddc80d1777a6

color: move 'valideffect' function into the core module
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2016 02:26:50 +0100
parents 0d2a58a04080
children 683606a829e8
line wrap: on
line diff
--- a/mercurial/color.py	Thu Dec 22 02:23:23 2016 +0100
+++ b/mercurial/color.py	Thu Dec 22 02:26:50 2016 +0100
@@ -113,3 +113,13 @@
 
 def loadcolortable(ui, extname, colortable):
     _styles.update(colortable)
+
+def valideffect(effect):
+    'Determine if the effect is valid or not.'
+    good = False
+    if not _terminfo_params and effect in _effects:
+        good = True
+    elif (effect in _terminfo_params
+          or effect[:-11] in _terminfo_params):
+        good = True
+    return good