mercurial/color.py
changeset 31105 45be7590301d
parent 31103 c1997c5d1ae3
child 31106 a185b903bda3
--- a/mercurial/color.py	Tue Feb 21 18:09:21 2017 +0100
+++ b/mercurial/color.py	Tue Feb 21 18:20:12 2017 +0100
@@ -161,6 +161,17 @@
               "ECMA-48 color\n"))
         _terminfo_params.clear()
 
+def setup(ui, coloropts):
+    """configure color on a ui
+
+    The 'coloropts' argument is the value of the '--color' command line
+    argument. That function both set the colormode for the ui object and read
+    the configuration looking for custom colors and effect definitions."""
+    mode = _modesetup(ui, coloropts)
+    ui.__class__._colormode = mode
+    if mode and mode != 'debug':
+        configstyles(ui)
+
 def _modesetup(ui, coloropt):
     if ui.plain():
         return None