Make blue text more readable. Closes #55.

This commit is contained in:
Hisham Muhammad 2014-04-24 13:15:52 -03:00
parent f86851766b
commit 100bd10b1d
5 changed files with 22 additions and 6 deletions

View File

@ -95,7 +95,7 @@ static void CPUMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CPU_KERNEL], buffer); RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
sprintf(buffer, "%5.1f%% ", this->values[0]); sprintf(buffer, "%5.1f%% ", this->values[0]);
RichString_append(out, CRT_colors[METER_TEXT], "ni:"); RichString_append(out, CRT_colors[METER_TEXT], "ni:");
RichString_append(out, CRT_colors[CPU_NICE], buffer); RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
sprintf(buffer, "%5.1f%% ", this->values[3]); sprintf(buffer, "%5.1f%% ", this->values[3]);
RichString_append(out, CRT_colors[METER_TEXT], "hi:"); RichString_append(out, CRT_colors[METER_TEXT], "hi:");
RichString_append(out, CRT_colors[CPU_IRQ], buffer); RichString_append(out, CRT_colors[CPU_IRQ], buffer);
@ -121,7 +121,7 @@ static void CPUMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CPU_KERNEL], buffer); RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
sprintf(buffer, "%5.1f%% ", this->values[0]); sprintf(buffer, "%5.1f%% ", this->values[0]);
RichString_append(out, CRT_colors[METER_TEXT], "low:"); RichString_append(out, CRT_colors[METER_TEXT], "low:");
RichString_append(out, CRT_colors[CPU_NICE], buffer); RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
if (this->values[3]) { if (this->values[3]) {
sprintf(buffer, "%5.1f%% ", this->values[3]); sprintf(buffer, "%5.1f%% ", this->values[3]);
RichString_append(out, CRT_colors[METER_TEXT], "vir:"); RichString_append(out, CRT_colors[METER_TEXT], "vir:");

14
CRT.c
View File

@ -85,6 +85,7 @@ typedef enum ColorElements_ {
GRAPH_9, GRAPH_9,
MEMORY_USED, MEMORY_USED,
MEMORY_BUFFERS, MEMORY_BUFFERS,
MEMORY_BUFFERS_TEXT,
MEMORY_CACHE, MEMORY_CACHE,
LOAD, LOAD,
LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIFTEEN,
@ -97,6 +98,7 @@ typedef enum ColorElements_ {
HELP_BOLD, HELP_BOLD,
HOSTNAME, HOSTNAME,
CPU_NICE, CPU_NICE,
CPU_NICE_TEXT,
CPU_NORMAL, CPU_NORMAL,
CPU_KERNEL, CPU_KERNEL,
CPU_IOWAIT, CPU_IOWAIT,
@ -293,6 +295,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_DIM; CRT_colors[GRAPH_9] = A_DIM;
CRT_colors[MEMORY_USED] = A_BOLD; CRT_colors[MEMORY_USED] = A_BOLD;
CRT_colors[MEMORY_BUFFERS] = A_NORMAL; CRT_colors[MEMORY_BUFFERS] = A_NORMAL;
CRT_colors[MEMORY_BUFFERS_TEXT] = A_NORMAL;
CRT_colors[MEMORY_CACHE] = A_NORMAL; CRT_colors[MEMORY_CACHE] = A_NORMAL;
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_DIM; CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_DIM;
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL; CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
@ -305,6 +308,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL; CRT_colors[CHECK_TEXT] = A_NORMAL;
CRT_colors[HOSTNAME] = A_BOLD; CRT_colors[HOSTNAME] = A_BOLD;
CRT_colors[CPU_NICE] = A_NORMAL; CRT_colors[CPU_NICE] = A_NORMAL;
CRT_colors[CPU_NICE_TEXT] = A_NORMAL;
CRT_colors[CPU_NORMAL] = A_BOLD; CRT_colors[CPU_NORMAL] = A_BOLD;
CRT_colors[CPU_KERNEL] = A_BOLD; CRT_colors[CPU_KERNEL] = A_BOLD;
CRT_colors[CPU_IOWAIT] = A_NORMAL; CRT_colors[CPU_IOWAIT] = A_NORMAL;
@ -354,6 +358,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = ColorPair(Yellow,White); CRT_colors[GRAPH_9] = ColorPair(Yellow,White);
CRT_colors[MEMORY_USED] = ColorPair(Green,White); CRT_colors[MEMORY_USED] = ColorPair(Green,White);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,White); CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,White);
CRT_colors[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,White);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,White); CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,White);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,White); CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,White);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,White); CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,White);
@ -366,6 +371,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Black,White); CRT_colors[CHECK_TEXT] = ColorPair(Black,White);
CRT_colors[HOSTNAME] = ColorPair(Black,White); CRT_colors[HOSTNAME] = ColorPair(Black,White);
CRT_colors[CPU_NICE] = ColorPair(Cyan,White); CRT_colors[CPU_NICE] = ColorPair(Cyan,White);
CRT_colors[CPU_NICE_TEXT] = ColorPair(Cyan,White);
CRT_colors[CPU_NORMAL] = ColorPair(Green,White); CRT_colors[CPU_NORMAL] = ColorPair(Green,White);
CRT_colors[CPU_KERNEL] = ColorPair(Red,White); CRT_colors[CPU_KERNEL] = ColorPair(Red,White);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, White); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, White);
@ -415,6 +421,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = ColorPair(Yellow,Black); CRT_colors[GRAPH_9] = ColorPair(Yellow,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black); CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,Black); CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,Black);
CRT_colors[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black); CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,Black); CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,Black); CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,Black);
@ -427,6 +434,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Black,Black); CRT_colors[CHECK_TEXT] = ColorPair(Black,Black);
CRT_colors[HOSTNAME] = ColorPair(White,Black); CRT_colors[HOSTNAME] = ColorPair(White,Black);
CRT_colors[CPU_NICE] = ColorPair(Cyan,Black); CRT_colors[CPU_NICE] = ColorPair(Cyan,Black);
CRT_colors[CPU_NICE_TEXT] = ColorPair(Cyan,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black); CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black); CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
@ -476,6 +484,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Yellow,Blue); CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Yellow,Blue);
CRT_colors[MEMORY_USED] = A_BOLD | ColorPair(Green,Blue); CRT_colors[MEMORY_USED] = A_BOLD | ColorPair(Green,Blue);
CRT_colors[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan,Blue); CRT_colors[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow,Blue); CRT_colors[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow,Blue);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Blue); CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Blue);
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White,Blue); CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White,Blue);
@ -488,6 +497,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue); CRT_colors[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue);
CRT_colors[HOSTNAME] = ColorPair(White,Blue); CRT_colors[HOSTNAME] = ColorPair(White,Blue);
CRT_colors[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue); CRT_colors[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[CPU_NORMAL] = A_BOLD | ColorPair(Green,Blue); CRT_colors[CPU_NORMAL] = A_BOLD | ColorPair(Green,Blue);
CRT_colors[CPU_KERNEL] = A_BOLD | ColorPair(Red,Blue); CRT_colors[CPU_KERNEL] = A_BOLD | ColorPair(Red,Blue);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Blue,Blue); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Blue,Blue);
@ -537,6 +547,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black); CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black); CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black); CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black);
CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black); CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black); CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black); CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black);
@ -549,6 +560,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Cyan,Black); CRT_colors[CHECK_TEXT] = ColorPair(Cyan,Black);
CRT_colors[HOSTNAME] = ColorPair(Green,Black); CRT_colors[HOSTNAME] = ColorPair(Green,Black);
CRT_colors[CPU_NICE] = ColorPair(Blue,Black); CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black); CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black); CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Black); CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Black);
@ -599,6 +611,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black); CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black); CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black); CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black);
CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black); CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Black); CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL; CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
@ -611,6 +624,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL; CRT_colors[CHECK_TEXT] = A_NORMAL;
CRT_colors[HOSTNAME] = A_BOLD; CRT_colors[HOSTNAME] = A_BOLD;
CRT_colors[CPU_NICE] = ColorPair(Blue,Black); CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black); CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black); CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);

2
CRT.h
View File

@ -76,6 +76,7 @@ typedef enum ColorElements_ {
GRAPH_9, GRAPH_9,
MEMORY_USED, MEMORY_USED,
MEMORY_BUFFERS, MEMORY_BUFFERS,
MEMORY_BUFFERS_TEXT,
MEMORY_CACHE, MEMORY_CACHE,
LOAD, LOAD,
LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIFTEEN,
@ -88,6 +89,7 @@ typedef enum ColorElements_ {
HELP_BOLD, HELP_BOLD,
HOSTNAME, HOSTNAME,
CPU_NICE, CPU_NICE,
CPU_NICE_TEXT,
CPU_NORMAL, CPU_NORMAL,
CPU_KERNEL, CPU_KERNEL,
CPU_IOWAIT, CPU_IOWAIT,

View File

@ -52,7 +52,7 @@ static void MemoryMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[MEMORY_USED], buffer); RichString_append(out, CRT_colors[MEMORY_USED], buffer);
sprintf(buffer, format, buffersMem); sprintf(buffer, format, buffersMem);
RichString_append(out, CRT_colors[METER_TEXT], "buffers:"); RichString_append(out, CRT_colors[METER_TEXT], "buffers:");
RichString_append(out, CRT_colors[MEMORY_BUFFERS], buffer); RichString_append(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer);
sprintf(buffer, format, cachedMem); sprintf(buffer, format, cachedMem);
RichString_append(out, CRT_colors[METER_TEXT], "cache:"); RichString_append(out, CRT_colors[METER_TEXT], "cache:");
RichString_append(out, CRT_colors[MEMORY_CACHE], buffer); RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);

6
htop.c
View File

@ -121,7 +121,7 @@ static void showHelp(ProcessList* pl) {
#define addattrstr(a,s) attrset(a);addstr(s) #define addattrstr(a,s) attrset(a);addstr(s)
addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[BAR_BORDER], "[");
if (pl->detailedCPUTime) { if (pl->detailedCPUTime) {
addattrstr(CRT_colors[CPU_NICE], "low"); addstr("/"); addattrstr(CRT_colors[CPU_NICE_TEXT], "low"); addstr("/");
addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/");
addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/");
addattrstr(CRT_colors[CPU_IRQ], "irq"); addstr("/"); addattrstr(CRT_colors[CPU_IRQ], "irq"); addstr("/");
@ -131,7 +131,7 @@ static void showHelp(ProcessList* pl) {
addattrstr(CRT_colors[CPU_IOWAIT], "io-wait"); addattrstr(CRT_colors[CPU_IOWAIT], "io-wait");
addattrstr(CRT_colors[BAR_SHADOW], " used%"); addattrstr(CRT_colors[BAR_SHADOW], " used%");
} else { } else {
addattrstr(CRT_colors[CPU_NICE], "low-priority"); addstr("/"); addattrstr(CRT_colors[CPU_NICE_TEXT], "low-priority"); addstr("/");
addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/");
addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/"); addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/");
addattrstr(CRT_colors[CPU_STEAL], "virtualiz"); addattrstr(CRT_colors[CPU_STEAL], "virtualiz");
@ -142,7 +142,7 @@ static void showHelp(ProcessList* pl) {
mvaddstr(4, 0, "Memory bar: "); mvaddstr(4, 0, "Memory bar: ");
addattrstr(CRT_colors[BAR_BORDER], "["); addattrstr(CRT_colors[BAR_BORDER], "[");
addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/"); addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/");
addattrstr(CRT_colors[MEMORY_BUFFERS], "buffers"); addstr("/"); addattrstr(CRT_colors[MEMORY_BUFFERS_TEXT], "buffers"); addstr("/");
addattrstr(CRT_colors[MEMORY_CACHE], "cache"); addattrstr(CRT_colors[MEMORY_CACHE], "cache");
addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_SHADOW], " used/total");
addattrstr(CRT_colors[BAR_BORDER], "]"); addattrstr(CRT_colors[BAR_BORDER], "]");