Generalize Meter value colors for IO

This commit is contained in:
Christian Göttsche 2020-10-16 19:44:53 +02:00 committed by cgzones
parent e9246abff8
commit a802961286
3 changed files with 27 additions and 27 deletions

36
CRT.c
View File

@ -96,6 +96,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Cyan,Black),
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
[PROCESS] = A_NORMAL,
@ -151,9 +154,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = ColorPair(Magenta,Black),
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
[ZFS_RATIO] = ColorPair(Magenta,Black),
[DISKIO_UTIL_HIGH] = A_BOLD | ColorPair(White,Black),
[DISKIO_READ] = ColorPair(Green,Black),
[DISKIO_WRITE] = ColorPair(Blue,Black),
},
[COLORSCHEME_MONOCHROME] = {
[RESET_COLOR] = A_NORMAL,
@ -172,6 +172,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD,
[METER_TEXT] = A_NORMAL,
[METER_VALUE] = A_BOLD,
[METER_VALUE_NOTICE] = A_BOLD,
[METER_VALUE_IOREAD] = A_NORMAL,
[METER_VALUE_IOWRITE] = A_NORMAL,
[LED_COLOR] = A_NORMAL,
[TASKS_RUNNING] = A_BOLD,
[PROCESS] = A_NORMAL,
@ -227,9 +230,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = A_DIM,
[ZFS_COMPRESSED] = A_BOLD,
[ZFS_RATIO] = A_BOLD,
[DISKIO_UTIL_HIGH] = A_BOLD,
[DISKIO_READ] = A_NORMAL,
[DISKIO_WRITE] = A_NORMAL,
},
[COLORSCHEME_BLACKONWHITE] = {
[RESET_COLOR] = ColorPair(Black,White),
@ -248,6 +248,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = ColorPair(Red,White),
[METER_TEXT] = ColorPair(Blue,White),
[METER_VALUE] = ColorPair(Black,White),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,White),
[METER_VALUE_IOREAD] = ColorPair(Green,White),
[METER_VALUE_IOWRITE] = ColorPair(Yellow,White),
[LED_COLOR] = ColorPair(Green,White),
[TASKS_RUNNING] = ColorPair(Green,White),
[PROCESS] = ColorPair(Black,White),
@ -303,9 +306,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = ColorPair(Magenta,White),
[ZFS_COMPRESSED] = ColorPair(Cyan,White),
[ZFS_RATIO] = ColorPair(Magenta,White),
[DISKIO_UTIL_HIGH] = A_BOLD | ColorPair(Yellow,White),
[DISKIO_READ] = ColorPair(Green,White),
[DISKIO_WRITE] = ColorPair(Blue,White),
},
[COLORSCHEME_LIGHTTERMINAL] = {
[RESET_COLOR] = ColorPair(Blue,Black),
@ -324,6 +324,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Blue,Black),
[METER_VALUE] = ColorPair(Blue,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Yellow,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = ColorPair(Green,Black),
[PROCESS] = ColorPair(Blue,Black),
@ -379,9 +382,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Black),
[ZFS_COMPRESSED] = ColorPair(Cyan,Black),
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Black),
[DISKIO_UTIL_HIGH] = A_BOLD | ColorPair(Yellow,Black),
[DISKIO_READ] = ColorPair(Green,Black),
[DISKIO_WRITE] = ColorPair(Blue,Black),
},
[COLORSCHEME_MIDNIGHT] = {
[RESET_COLOR] = ColorPair(White,Blue),
@ -400,6 +400,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Blue),
[METER_TEXT] = ColorPair(Cyan,Blue),
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Blue),
[METER_VALUE_IOREAD] = ColorPair(Green,Blue),
[METER_VALUE_IOWRITE] = ColorPair(Black,Blue),
[LED_COLOR] = ColorPair(Green,Blue),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue),
[PROCESS] = ColorPair(White,Blue),
@ -455,9 +458,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Blue),
[ZFS_COMPRESSED] = A_BOLD | ColorPair(White,Blue),
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Blue),
[DISKIO_UTIL_HIGH] = A_BOLD | ColorPair(White,Blue),
[DISKIO_READ] = ColorPair(Green,Blue),
[DISKIO_WRITE] = ColorPair(Black,Blue),
},
[COLORSCHEME_BLACKNIGHT] = {
[RESET_COLOR] = ColorPair(Cyan,Black),
@ -476,6 +476,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Cyan,Black),
[METER_VALUE] = ColorPair(Green,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
[LED_COLOR] = ColorPair(Green,Black),
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
[PROCESS] = ColorPair(Cyan,Black),
@ -529,9 +532,6 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[ZFS_OTHER] = ColorPair(Magenta,Black),
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
[ZFS_RATIO] = ColorPair(Magenta,Black),
[DISKIO_UTIL_HIGH] = A_BOLD | ColorPair(Green,Black),
[DISKIO_READ] = ColorPair(Green,Black),
[DISKIO_WRITE] = ColorPair(Blue,Black),
},
[COLORSCHEME_BROKENGRAY] = { 0 } // dynamically generated.
};

6
CRT.h
View File

@ -48,6 +48,9 @@ typedef enum ColorElements_ {
LARGE_NUMBER,
METER_TEXT,
METER_VALUE,
METER_VALUE_NOTICE,
METER_VALUE_IOREAD,
METER_VALUE_IOWRITE,
LED_COLOR,
UPTIME,
BATTERY,
@ -105,9 +108,6 @@ typedef enum ColorElements_ {
ZFS_OTHER,
ZFS_COMPRESSED,
ZFS_RATIO,
DISKIO_UTIL_HIGH,
DISKIO_READ,
DISKIO_WRITE,
LAST_COLORELEMENT
} ColorElements;

View File

@ -14,9 +14,9 @@ in the source distribution for its full text.
static const int DiskIOMeter_attributes[] = {
DISKIO_UTIL_HIGH,
DISKIO_READ,
DISKIO_WRITE,
METER_VALUE_NOTICE,
METER_VALUE_IOREAD,
METER_VALUE_IOWRITE,
};
static unsigned long int cached_read_diff = 0;
@ -62,17 +62,17 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
static void DIskIOMeter_display(ATTR_UNUSED const Object* cast, RichString* out) {
char buffer[16];
int color = cached_utilisation_diff > 40.0 ? DISKIO_UTIL_HIGH : METER_VALUE;
int color = cached_utilisation_diff > 40.0 ? METER_VALUE_NOTICE : METER_VALUE;
xSnprintf(buffer, sizeof(buffer), "%.1f%%", cached_utilisation_diff);
RichString_write(out, CRT_colors[color], buffer);
RichString_append(out, CRT_colors[METER_TEXT], " read: ");
Meter_humanUnit(buffer, cached_read_diff, sizeof(buffer));
RichString_append(out, CRT_colors[DISKIO_READ], buffer);
RichString_append(out, CRT_colors[METER_VALUE_IOREAD], buffer);
RichString_append(out, CRT_colors[METER_TEXT], " write: ");
Meter_humanUnit(buffer, cached_write_diff, sizeof(buffer));
RichString_append(out, CRT_colors[DISKIO_WRITE], buffer);
RichString_append(out, CRT_colors[METER_VALUE_IOWRITE], buffer);
}
const MeterClass DiskIOMeter_class = {