hgext/color.py
changeset 30285 bb2dfc0ea5b4
parent 30284 7556507f7197
child 30286 d44c407a5999
--- a/hgext/color.py	Thu Nov 03 14:48:47 2016 +0100
+++ b/hgext/color.py	Thu Nov 03 15:15:47 2016 +0100
@@ -556,7 +556,10 @@
                 elif k.startswith('terminfo.'):
                     _styles[k] = k[9:]
         ui.write(_('available colors:\n'))
-        for colorname, label in _styles.items():
+        # sort label with a '_' after the other to group '_background' entry.
+        items = sorted(_styles.items(),
+                       key=lambda i: ('_' in i[0], i[0], i[1]))
+        for colorname, label in items:
             ui.write(('%s\n') % colorname, label=label)
     finally:
         _styles = oldstyle