Skip to content

Commit

Permalink
Merge branch 'fix-palette2' of deviant/htop
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lange authored and Daniel Lange committed Jan 11, 2021
2 parents b3500ac + f2f1c99 commit 5d92a9f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ in the source distribution for its full text.
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)

#define ColorPairWhiteDefault ColorPair(Red, Red)
#define ColorIndexWhiteDefault ColorIndex(Red, Red)

static const char* const CRT_treeStrAscii[LAST_TREE_STR] = {
[TREE_STR_VERT] = "|",
[TREE_STR_RTEE] = "`",
Expand Down Expand Up @@ -371,7 +374,7 @@ static int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
[METER_VALUE_IOWRITE] = ColorPair(Yellow, Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPairWhiteDefault,
[METER_VALUE_OK] = ColorPair(Green, Black),
[METER_VALUE_WARN] = A_BOLD | ColorPair(Yellow, Black),
[LED_COLOR] = ColorPair(Green, Black),
Expand Down Expand Up @@ -405,15 +408,15 @@ static int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black, Black),
[LOAD_AVERAGE_FIVE] = ColorPair(Black, Black),
[LOAD_AVERAGE_ONE] = ColorPair(Black, Black),
[LOAD] = ColorPair(White, Black),
[LOAD] = ColorPairWhiteDefault,
[HELP_BOLD] = ColorPair(Blue, Black),
[CLOCK] = ColorPair(White, Black),
[DATE] = ColorPair(White, Black),
[DATETIME] = ColorPair(White, Black),
[CLOCK] = ColorPairWhiteDefault,
[DATE] = ColorPairWhiteDefault,
[DATETIME] = ColorPairWhiteDefault,
[CHECK_BOX] = ColorPair(Blue, Black),
[CHECK_MARK] = ColorPair(Black, Black),
[CHECK_TEXT] = ColorPair(Black, Black),
[HOSTNAME] = ColorPair(White, Black),
[HOSTNAME] = ColorPairWhiteDefault,
[CPU_NICE] = ColorPair(Cyan, Black),
[CPU_NICE_TEXT] = ColorPair(Cyan, Black),
[CPU_NORMAL] = ColorPair(Green, Black),
Expand Down Expand Up @@ -789,7 +792,7 @@ void CRT_setColors(int colorScheme) {

for (short int i = 0; i < 8; i++) {
for (short int j = 0; j < 8; j++) {
if (ColorIndex(i, j) != ColorIndexGrayBlack) {
if (ColorIndex(i, j) != ColorIndexGrayBlack && ColorIndex(i, j) != ColorIndexWhiteDefault) {
short int bg = (colorScheme != COLORSCHEME_BLACKNIGHT)
? (j == 0 ? -1 : j)
: j;
Expand All @@ -802,6 +805,8 @@ void CRT_setColors(int colorScheme) {
short int grayBlackBg = (colorScheme != COLORSCHEME_BLACKNIGHT) ? -1 : 0;
init_pair(ColorIndexGrayBlack, grayBlackFg, grayBlackBg);

init_pair(ColorIndexWhiteDefault, White, -1);

CRT_colors = CRT_colorSchemes[colorScheme];
}

Expand Down

0 comments on commit 5d92a9f

Please sign in to comment.