From: haoyixing Date: Fri, 8 Jan 2021 03:29:01 +0000 (+0800) Subject: pybind/mgr: change format_bytes unit color from black to yellow X-Git-Tag: v16.1.0~71^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38809%2Fhead;p=ceph.git pybind/mgr: change format_bytes unit color from black to yellow Currently format_bytes output (such as ceph fs status) makes unit black, which is hard to distinguish on black terminals, so change them as same as the data itself. Signed-off-by: haoyixing --- diff --git a/src/pybind/ceph_daemon.py b/src/pybind/ceph_daemon.py index 9b55613f5d9b..b975c887ea9c 100644 --- a/src/pybind/ceph_daemon.py +++ b/src/pybind/ceph_daemon.py @@ -191,7 +191,7 @@ class DaemonWatcher(object): unit = 0 while len("%s" % (int(n) // (1000**unit))) > width - 1: if unit >= len(units) - 1: - break; + break unit += 1 if unit > 0: @@ -208,7 +208,7 @@ class DaemonWatcher(object): else: color = self.YELLOW, False return self.bold(self.colorize(formatted[0:-1], color[0], color[1])) \ - + self.bold(self.colorize(formatted[-1], self.BLACK, False)) + + self.bold(self.colorize(formatted[-1], self.YELLOW, False)) else: return formatted diff --git a/src/pybind/mgr/mgr_util.py b/src/pybind/mgr/mgr_util.py index 4513777970bb..1ae6992dc5cc 100644 --- a/src/pybind/mgr/mgr_util.py +++ b/src/pybind/mgr/mgr_util.py @@ -331,7 +331,7 @@ def format_units(n, width, colored, decimal): else: color = YELLOW, False return bold(colorize(formatted[0:-1], color[0], color[1])) \ - + bold(colorize(formatted[-1], BLACK, False)) + + bold(colorize(formatted[-1], YELLOW, False)) else: return formatted