From 32fdbbb985f1e497ca6eb7932a6ab5732b91f11d Mon Sep 17 00:00:00 2001 From: haoyixing Date: Fri, 8 Jan 2021 11:29:01 +0800 Subject: [PATCH] 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 --- src/pybind/ceph_daemon.py | 4 ++-- src/pybind/mgr/mgr_util.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/ceph_daemon.py b/src/pybind/ceph_daemon.py index 9b55613f5d9..b975c887ea9 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 4513777970b..1ae6992dc5c 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 -- 2.39.5