… | |
… | |
421 | /* this is how xterm implements reverseVideo */ |
421 | /* this is how xterm implements reverseVideo */ |
422 | if (OPTION (Opt_reverseVideo)) |
422 | if (OPTION (Opt_reverseVideo)) |
423 | { |
423 | { |
424 | if (!rs[Rs_color + Color_fg]) |
424 | if (!rs[Rs_color + Color_fg]) |
425 | rs[Rs_color + Color_fg] = def_colorName[Color_bg]; |
425 | rs[Rs_color + Color_fg] = def_colorName[Color_bg]; |
|
|
426 | |
426 | if (!rs[Rs_color + Color_bg]) |
427 | if (!rs[Rs_color + Color_bg]) |
427 | rs[Rs_color + Color_bg] = def_colorName[Color_fg]; |
428 | rs[Rs_color + Color_bg] = def_colorName[Color_fg]; |
428 | } |
429 | } |
429 | #endif |
430 | #endif |
430 | |
431 | |
… | |
… | |
655 | pix_colors = pix_colors_focused; |
656 | pix_colors = pix_colors_focused; |
656 | #endif |
657 | #endif |
657 | |
658 | |
658 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
659 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
659 | { |
660 | { |
|
|
661 | const char *name = rs[Rs_color + i]; |
|
|
662 | |
|
|
663 | if (!name) |
|
|
664 | continue; |
|
|
665 | |
660 | rxvt_color xcol; |
666 | rxvt_color xcol; |
661 | |
667 | |
662 | if (!rs[Rs_color + i]) |
|
|
663 | continue; |
|
|
664 | |
|
|
665 | if (!set_color (xcol, rs[Rs_color + i])) |
668 | if (!set_color (xcol, name)) |
666 | { |
669 | { |
667 | #ifndef XTERM_REVERSE_VIDEO |
670 | #ifndef XTERM_REVERSE_VIDEO |
668 | if (i < 2 && OPTION (Opt_reverseVideo)) |
671 | if (i < 2 && OPTION (Opt_reverseVideo)) |
669 | rs[Rs_color + i] = def_colorName[!i]; |
672 | name = def_colorName [1 - i]; |
670 | else |
673 | else |
671 | #endif |
674 | #endif |
672 | rs[Rs_color + i] = def_colorName[i]; |
675 | name = def_colorName [i]; |
673 | |
676 | |
674 | if (!rs[Rs_color + i]) |
677 | if (!name) |
675 | continue; |
678 | continue; |
676 | |
679 | |
677 | if (!set_color (xcol, rs[Rs_color + i])) |
680 | if (!set_color (xcol, name)) |
678 | { |
681 | { |
679 | switch (i) |
682 | switch (i) |
680 | { |
683 | { |
681 | case Color_fg: |
684 | case Color_fg: |
682 | case Color_bg: |
685 | case Color_bg: |
683 | /* fatal: need bg/fg color */ |
|
|
684 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
686 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
|
|
687 | name = ""; |
685 | break; |
688 | break; |
686 | #ifndef NO_CURSORCOLOR |
689 | #ifndef NO_CURSORCOLOR |
687 | case Color_cursor2: |
690 | case Color_cursor2: |
688 | xcol = pix_colors[Color_fg]; |
691 | #endif |
689 | break; |
|
|
690 | #endif /* ! NO_CURSORCOLOR */ |
|
|
691 | case Color_pointer_fg: |
692 | case Color_pointer_fg: |
|
|
693 | name = rs[Rs_color + Color_fg]; |
692 | xcol = pix_colors[Color_fg]; |
694 | xcol = pix_colors[Color_fg]; |
693 | break; |
695 | break; |
694 | default: |
696 | default: |
|
|
697 | name = rs[Rs_color + Color_bg]; |
695 | xcol = pix_colors[Color_bg]; /* None */ |
698 | xcol = pix_colors[Color_bg]; |
696 | break; |
699 | break; |
697 | } |
700 | } |
698 | } |
701 | } |
699 | } |
702 | } |
700 | |
703 | |
701 | pix_colors[i] = xcol; |
704 | pix_colors[i] = xcol; |
702 | SET_PIXCOLOR (i); |
705 | rs[Rs_color + i] = name; |
703 | } |
706 | } |
704 | |
707 | |
705 | #ifdef OFF_FOCUS_FADING |
708 | #ifdef OFF_FOCUS_FADING |
706 | if (rs[Rs_fade]) |
709 | if (rs[Rs_fade]) |
707 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
710 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
708 | { |
711 | { |
709 | rxvt_rgba c; |
712 | rgba c; |
710 | pix_colors[Color_fade].get (this, c); |
713 | pix_colors[Color_fade].get (this, c); |
711 | pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
714 | pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
712 | } |
715 | } |
713 | #endif |
716 | #endif |
714 | |
717 | |
… | |
… | |
740 | /* xcol[0] == white |
743 | /* xcol[0] == white |
741 | * xcol[1] == top shadow |
744 | * xcol[1] == top shadow |
742 | * xcol[2] == bot shadow */ |
745 | * xcol[2] == bot shadow */ |
743 | |
746 | |
744 | xcol[1] = pix_colors[Color_scroll]; |
747 | xcol[1] = pix_colors[Color_scroll]; |
745 | xcol[0].set (this, rxvt_rgba (rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC)); |
748 | xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC)); |
746 | |
749 | |
747 | rxvt_rgba c0, c1; |
750 | rgba c0, c1; |
748 | |
751 | |
749 | xcol[0].get (this, c0); |
752 | xcol[0].get (this, c0); |
750 | xcol[1].get (this, c1); |
753 | xcol[1].get (this, c1); |
751 | |
754 | |
752 | xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); |
755 | xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); |
753 | |
756 | |
754 | /* topShadowColor */ |
757 | /* topShadowColor */ |
755 | if (!xcol[1].set (this, |
758 | if (!xcol[1].set (this, |
756 | rxvt_rgba ( |
759 | rgba ( |
757 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
760 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
758 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
761 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
759 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
762 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
760 | c1.a) // pa1 vs. pa0: arbitrary |
763 | c1.a) // pa1 vs. pa0: arbitrary |
761 | )); |
764 | )); |