Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix the red/blue swappage in a way that's portable to all terminals.

xterm is crazy: set_foreground and set_a_foreground use different colour models
 (RGB vs BGR).
  • Loading branch information...
commit 8a360e34cb4da71b38cd429152ab6839044ff901 1 parent 8a8c47f
ec429 authored
Showing with 34 additions and 30 deletions.
  1. +8 −8 buffer.c
  2. +8 −8 c_init.c
  3. +2 −2 colour.c
  4. +8 −8 colour.d
  5. +8 −4 ttyesc.c
16 buffer.c
View
@@ -524,22 +524,22 @@ void in_update(iline inp)
}
else if(b==bufs[cbuf].server)
{
- c.back=1; // blue
+ c.back=4; // blue
c.ul=true;
}
if(bufs[b].hi_alert%2)
{
- c.fore=3; // cyan
+ c.fore=6; // cyan
c.hi=true;
}
else if(bufs[b].alert)
{
- c.fore=4; // red
+ c.fore=1; // red
c.hi=true;
}
if((!LIVE(b)) && (c.fore!=6))
{
- c.fore=6; // yellow
+ c.fore=3; // yellow
c.hi=true;
}
setcolour(c);
@@ -712,14 +712,14 @@ char *highlight(const char *src)
src++;
break;
case '\\':
- s_setcol(6, 0, 1, 0, &rv, &l, &i);
+ s_setcol(3, 0, 1, 0, &rv, &l, &i);
append_char(&rv, &l, &i, '\\');
append_char(&rv, &l, &i, '\\');
s_setcol(7, 0, 0, 0, &rv, &l, &i);
src++;
break;
case 0:
- s_setcol(1, 0, 1, 0, &rv, &l, &i);
+ s_setcol(4, 0, 1, 0, &rv, &l, &i);
append_char(&rv, &l, &i, '\\');
s_setcol(7, 0, 0, 0, &rv, &l, &i);
break;
@@ -727,7 +727,7 @@ char *highlight(const char *src)
case '1':
case '2':
case '3':
- s_setcol(3, 0, 1, 0, &rv, &l, &i);
+ s_setcol(6, 0, 1, 0, &rv, &l, &i);
append_char(&rv, &l, &i, '\\');
append_char(&rv, &l, &i, *++src);
int digits=0;
@@ -738,7 +738,7 @@ char *highlight(const char *src)
s_setcol(7, 0, 0, 0, &rv, &l, &i);
break;
default:
- s_setcol(4, 0, 1, 0, &rv, &l, &i);
+ s_setcol(1, 0, 1, 0, &rv, &l, &i);
append_char(&rv, &l, &i, '\\');
s_setcol(7, 0, 0, 0, &rv, &l, &i);
break;
16 c_init.c
View
@@ -3,12 +3,12 @@ curr.fore=7;curr.back=0;curr.hi=0;curr.ul=1; c_msg[0]=curr;
curr.fore=7;curr.back=0;curr.hi=0;curr.ul=0; c_msg[1]=curr;
curr.fore=7;curr.back=0;curr.hi=1;curr.ul=0; c_notice[0]=curr;c_notice[1]=curr;
curr.fore=2;curr.back=0;curr.hi=1;curr.ul=0; c_join[0]=curr;c_join[1]=curr;
-curr.fore=3;curr.back=0;curr.hi=1;curr.ul=0; c_part[0]=curr;c_part[1]=curr;
-curr.fore=6;curr.back=0;curr.hi=1;curr.ul=0; c_quit[0]=curr;c_quit[1]=curr;
-curr.fore=1;curr.back=0;curr.hi=1;curr.ul=0; c_nick[0]=curr;c_nick[1]=curr;
-curr.fore=0;curr.back=6;curr.hi=0;curr.ul=1; c_actn[0]=curr;
-curr.fore=0;curr.back=6;curr.hi=0;curr.ul=0; c_actn[1]=curr;
+curr.fore=6;curr.back=0;curr.hi=1;curr.ul=0; c_part[0]=curr;c_part[1]=curr;
+curr.fore=3;curr.back=0;curr.hi=1;curr.ul=0; c_quit[0]=curr;c_quit[1]=curr;
+curr.fore=4;curr.back=0;curr.hi=1;curr.ul=0; c_nick[0]=curr;c_nick[1]=curr;
+curr.fore=0;curr.back=3;curr.hi=0;curr.ul=1; c_actn[0]=curr;
+curr.fore=0;curr.back=3;curr.hi=0;curr.ul=0; c_actn[1]=curr;
curr.fore=5;curr.back=0;curr.hi=0;curr.ul=0; c_status=curr;
-curr.fore=4;curr.back=0;curr.hi=1;curr.ul=0; c_err=curr;
-curr.fore=6;curr.back=1;curr.hi=0;curr.ul=0; c_unk=curr;
-curr.fore=4;curr.back=3;curr.hi=0;curr.ul=1; c_unn=curr;
+curr.fore=1;curr.back=0;curr.hi=1;curr.ul=0; c_err=curr;
+curr.fore=3;curr.back=4;curr.hi=0;curr.ul=0; c_unk=curr;
+curr.fore=1;curr.back=6;curr.hi=0;curr.ul=1; c_unn=curr;
4 colour.c
View
@@ -23,9 +23,9 @@ colour c_mirc(int fore, int back)
/*mIRC colours:
0=white, 1=black, 2=dk blue, 3=green, 4=red, 5=maroon, 6=purple, 7=orange, 8=yellow, 9=lt green, 10=teal, 11=cyan, 12=blue, 13=fuchsia, 14=dk gray, 15=lt gray
converted:
-0->7, 1->0, 2->1, 3->2, 4->4, 5->4, 6->5, 7->6, 8->6, 9->2, 10->3, 11->3, 12->1, 13->5, 14->0(7), 15->7
+0->7, 1->0, 2->4, 3->2, 4->1, 5->1, 6->5, 7->3, 8->3, 9->2, 10->6, 11->6, 12->4, 13->5, 14->0(7), 15->7
*/
- const int col[16]={7, 0, 1, 2, 4, 4, 5, 6, 6, 2, 3, 3, 1, 5, 0, 7};
+ const int col[16]={7, 0, 4, 2, 1, 1, 5, 3, 3, 2, 6, 6, 4, 5, 0, 7};
colour rv={7, 0, false, false};
if((fore>=0) && (fore<16))
{
16 colour.d
View
@@ -4,12 +4,12 @@ S msg 7 0 0 1
R msg 7 0 0 0
% notice 7 0 1 0
% join 2 0 1 0
-% part 3 0 1 0
-% quit 6 0 1 0
-% nick 1 0 1 0
-S actn 0 6 0 1
-R actn 0 6 0 0
+% part 6 0 1 0
+% quit 3 0 1 0
+% nick 4 0 1 0
+S actn 0 3 0 1
+R actn 0 3 0 0
! status 5 0 0 0
-! err 4 0 1 0
-! unk 6 1 0 0
-! unn 4 3 0 1
+! err 1 0 1 0
+! unk 3 4 0 0
+! unn 1 6 0 1
12 ttyesc.c
View
@@ -25,9 +25,11 @@ int setcol(int fore, int back, bool hi, bool ul)
if(!su) su=enter_standout_mode;
if(!su) su="";
if(ul) putp(su);
- const char *f=tparm(set_foreground, fore);
+ const char *f=tparm(set_a_foreground, fore);
+ if(!f) f=tparm(set_foreground, fore);
if(f) putp(f);
- const char *b=tparm(set_background, back);
+ const char *b=tparm(set_a_background, back);
+ if(!f) f=tparm(set_background, back);
if(b) putp(b);
fflush(stdout);
return(0);
@@ -50,9 +52,11 @@ int s_setcol(int fore, int back, bool hi, bool ul, char **rv, int *l, int *i)
if(!su) su=enter_standout_mode;
if(!su) su="";
if(ul) append_str(rv, l, i, su);
- const char *f=tparm(set_foreground, fore);
+ const char *f=tparm(set_a_foreground, fore);
+ if(!f) f=tparm(set_foreground, fore);
if(f) append_str(rv, l, i, f);
- const char *b=tparm(set_background, back);
+ const char *b=tparm(set_a_background, back);
+ if(!f) f=tparm(set_background, back);
if(b) append_str(rv, l, i, b);
return(0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.