init_pair(CP_WHITE, 232, trans);
init_pair(CP_BLUE, 21, trans);
init_pair(CP_RED, 196, trans);
+ init_pair(CP_BLACK, 15, 232);
} else {
init_pair(CP_WHITE, 255, trans);
init_pair(CP_BLUE, 123, trans);
init_pair(CP_RED, 213, trans);
+ init_pair(CP_BLACK, 16, 255);
}
init_pair(CP_YELLOW, 208, trans);
if(invert) {
init_pair(CP_WHITE, 0, trans);
+ init_pair(CP_BLACK, 7, 0);
} else {
init_pair(CP_WHITE, 7, trans);
+ init_pair(CP_BLACK, 0, 7);
}
init_pair(CP_BLUE, 4, trans);
init_pair(CP_RED, 1, trans);
offset = CODE_INDENT;
// reverse color for code blocks
- wattron(window, A_REVERSE);
+ if(colors)
+ wattron(window, COLOR_PAIR(CP_BLACK));
// print whole lines
mvwprintw(window,
if(CHECK_BIT(line->bits, IS_QUOTE)) {
while(line->text->text[offset] == '>') {
// print a reverse color block
- wattron(window, A_REVERSE);
- wprintw(window, "%s", " ");
- wattroff(window, A_REVERSE);
- wprintw(window, "%s", " ");
+ if(colors) {
+ wattron(window, COLOR_PAIR(CP_BLACK));
+ wprintw(window, "%s", " ");
+ wattron(window, COLOR_PAIR(CP_WHITE));
+ wprintw(window, "%s", " ");
+ } else {
+ wprintw(window, "%s", ">");
+ }
+
// find next quote or break
offset++;
if(line->text->text[offset] == ' ')
case '_':
wattroff(window, A_UNDERLINE);
break;
- // disable inline code
+ // disable inline code
case '`':
- wattroff(window, A_REVERSE);
- break;
+ if(colors)
+ wattron(window, COLOR_PAIR(CP_WHITE));
+ break;
}
// remove top special char from stack
break;
// enable inline code
case '`':
- wattron(window, A_REVERSE);
+ if(colors)
+ wattron(window, COLOR_PAIR(CP_BLACK));
break;
// do nothing for backslashes
}
break;
// disable inline code
case '`':
- wattroff(window, A_REVERSE);
+ if(colors)
+ wattron(window, COLOR_PAIR(CP_WHITE));
break;
// do nothing for backslashes
}
if(colors)
wattron(window, COLOR_PAIR(CP_WHITE));
wattroff(window, A_UNDERLINE);
- wattroff(window, A_REVERSE);
}
(stack->delete)(stack);
void fade_out(WINDOW *window, int trans, int colors, int invert) {
int i; // increment
- if(colors) {
+ if(colors && COLORS == 256) {
for(i = 22; i >= 0; i--) {
// dim color pairs
init_pair(CP_WHITE, white_ramp_invert[i], trans);
init_pair(CP_BLUE, blue_ramp_invert[i], trans);
init_pair(CP_RED, red_ramp_invert[i], trans);
+ init_pair(CP_BLACK, 15, white_ramp_invert[i]);
} else {
init_pair(CP_WHITE, white_ramp[i], trans);
init_pair(CP_BLUE, blue_ramp[i], trans);
init_pair(CP_RED, red_ramp[i], trans);
+ init_pair(CP_BLACK, 16, white_ramp[i]);
}
// refresh window with new color
void fade_in(WINDOW *window, int trans, int colors, int invert) {
int i; // increment
- if(colors) {
+ if(colors && COLORS == 256) {
for(i = 0; i <= 23; i++) {
// brighten color pairs
init_pair(CP_WHITE, white_ramp_invert[i], trans);
init_pair(CP_BLUE, blue_ramp_invert[i], trans);
init_pair(CP_RED, red_ramp_invert[i], trans);
+ init_pair(CP_BLACK, 15, white_ramp_invert[i]);
} else {
init_pair(CP_WHITE, white_ramp[i], trans);
init_pair(CP_BLUE, blue_ramp[i], trans);
init_pair(CP_RED, red_ramp[i], trans);
+ init_pair(CP_BLACK, 16, white_ramp[i]);
}
// refresh window with new color