diff --git a/hgext/color.py b/hgext/color.py
index 2a74c5af892f5e958b93571af75312d67b31c3c2_aGdleHQvY29sb3IucHk=..2606e7f227f679e63373ab399dc4e4ac65d13713_aGdleHQvY29sb3IucHk= 100644
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -341,6 +341,7 @@
         if self._colormode is None:
             return super(colorui, self).popbuffer(labeled)
 
+        self._bufferstates.pop()
         if labeled:
             return ''.join(self.label(a, label) for a, label
                            in self._buffers.pop())
@@ -366,6 +367,8 @@
             return super(colorui, self).write_err(*args, **opts)
 
         label = opts.get('label', '')
+        if self._bufferstates and self._bufferstates[-1]:
+            return self.write(*args, **opts)
         if self._colormode == 'win32':
             for a in args:
                 win32print(a, super(colorui, self).write_err, **opts)