Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 60 lines (52 sloc) 1.259 kB
fcf9495 Refactored .quirc and cmdline parsing; other refactoring
Sound and Fury authored
1 /*
003269b wrote render_buffer(); untested
ec429 authored
2 quIRC - simple terminal-based IRC client
1bd8f39 Nudge copyright year (to "2010-12")
ec429 authored
3 Copyright (C) 2010-12 Edward Cree
003269b wrote render_buffer(); untested
ec429 authored
4
fcf9495 Refactored .quirc and cmdline parsing; other refactoring
Sound and Fury authored
5 See quirc.c for license information
6 colour: defined colours & mirc-colour-compat
7 */
8
dbc7d09 Framework ready for custom colours
Sound and Fury authored
9 #include "colour.h"
95ecd63 Fix the bug with input-line overrun from magic \%03o codes
ec429 authored
10 #include "ttyesc.h"
11
12 inline bool eq_colour(colour a, colour b)
13 {
14 if(a.fore!=b.fore) return(false);
15 if(a.back!=b.back) return(false);
16 if(a.hi!=b.hi) return(false);
17 if(a.ul!=b.ul) return(false);
18 return(true);
19 }
dbc7d09 Framework ready for custom colours
Sound and Fury authored
20
21 int setcolour(colour c)
22 {
23 return(setcol(c.fore, c.back, c.hi, c.ul));
24 }
94183bc Decode (and optionally use for display) mIRC colour codes
Sound and Fury authored
25
e808d4d Make strbuf and callers use size_t instead of int
ec429 authored
26 int s_setcolour(colour c, char **rv, size_t *l, size_t *i)
003269b wrote render_buffer(); untested
ec429 authored
27 {
28 return(s_setcol(c.fore, c.back, c.hi, c.ul, rv, l, i));
29 }
30
94183bc Decode (and optionally use for display) mIRC colour codes
Sound and Fury authored
31 colour c_mirc(int fore, int back)
32 {
33 /*mIRC colours:
34 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
35 converted:
8a360e3 Fix the red/blue swappage in a way that's portable to all terminals.
ec429 authored
36 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
94183bc Decode (and optionally use for display) mIRC colour codes
Sound and Fury authored
37 */
8a360e3 Fix the red/blue swappage in a way that's portable to all terminals.
ec429 authored
38 const int col[16]={7, 0, 4, 2, 1, 1, 5, 3, 3, 2, 6, 6, 4, 5, 0, 7};
94183bc Decode (and optionally use for display) mIRC colour codes
Sound and Fury authored
39 colour rv={7, 0, false, false};
40 if((fore>=0) && (fore<16))
41 {
42 rv.fore=col[fore];
43 }
44 if((back>=0) && (back<16))
45 {
46 rv.back=col[back];
47 }
48 if(rv.fore==rv.back)
49 {
50 rv.fore=7-rv.back;
51 }
52 return(rv);
53 }
ac506d8 Generate the default colours from an awk script
Sound and Fury authored
54
55 int c_init(void)
56 {
57 #include "c_init.c"
58 return(0);
59 }
Something went wrong with that request. Please try again.