@@ -25,6 +25,18 @@ extern tInfoTypeMapping InfoTypes [];
25
25
26
26
#define SHOW_TRUE (x ) ((x) ? " yes" : " no" )
27
27
28
+ static char * sColourNames [8 ] =
29
+ {
30
+ " Black" ,
31
+ " Red" ,
32
+ " Green" ,
33
+ " Yellow" ,
34
+ " Blue" ,
35
+ " Magenta" ,
36
+ " Cyan" ,
37
+ " White"
38
+ };
39
+
28
40
// compare-less for colours
29
41
struct colour_less : binary_function<COLORREF, COLORREF, bool >
30
42
{
@@ -88,7 +100,7 @@ static void ShowOneColour (CMUSHclientDoc * pDoc,
88
100
89
101
pDoc->ColourTell (strTextColour, ColourToName (iColour), strName);
90
102
91
- strName = CFormat (" R=%3i G=%3i B=%3i " , // RGB
103
+ strName = CFormat (" R=%3i G=%3i B=%3i " , // RGB
92
104
iRed,
93
105
iGreen,
94
106
iBlue);
@@ -114,6 +126,34 @@ static void ShowOneColour (CMUSHclientDoc * pDoc,
114
126
115
127
} // end of ShowOneColour
116
128
129
+ static void ShowAnsiColour (CMUSHclientDoc * pDoc,
130
+ CString strColourName,
131
+ const COLORREF iColour)
132
+
133
+ {
134
+ int iRed = GetRValue (iColour);
135
+ int iGreen = GetGValue (iColour);
136
+ int iBlue = GetBValue (iColour);
137
+
138
+ CString strName = CFormat (" %-24s " , (LPCTSTR) strColourName);
139
+
140
+ CString strTextColour = " black" ;
141
+
142
+ // if colour is dark, use white, otherwise use black
143
+ if (((GetRValue (iColour) & 0xFF ) +
144
+ (GetGValue (iColour) & 0xFF ) +
145
+ (GetBValue (iColour) & 0xFF ) ) < (128 * 3 ))
146
+ strTextColour = " white" ;
147
+
148
+ pDoc->ColourTell (strTextColour, ColourToName (iColour), strName);
149
+ pDoc->ColourTell (ColourToName (iColour), ColourToName (pDoc->m_normalcolour [0 ]), strName);
150
+ pDoc->ColourTell (ColourToName (pDoc->m_normalcolour [7 ]), ColourToName (iColour), strName);
151
+
152
+ pDoc->Note (" " );
153
+
154
+ } // end of ShowAnsiColour
155
+
156
+
117
157
VARIANT CMUSHclientDoc::Debug (LPCTSTR Command)
118
158
{
119
159
VARIANT vaResult;
@@ -150,7 +190,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
150
190
// -----------------------------------------------------------------------
151
191
// colours
152
192
// -----------------------------------------------------------------------
153
- if (strcmp (Command, " colours" ) == 0 )
193
+ if (strcmp (Command, " colours" ) == 0 || strcmp (Command, " colors " ) == 0 )
154
194
{
155
195
156
196
multimap<COLORREF, string, colour_less> mColours ;
@@ -176,7 +216,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
176
216
// -----------------------------------------------------------------------
177
217
// colours256
178
218
// -----------------------------------------------------------------------
179
- else if (strcmp (Command, " colours256" ) == 0 )
219
+ else if (strcmp (Command, " colours256" ) == 0 || strcmp (Command, " colors256 " ) == 0 )
180
220
{
181
221
182
222
for (int i = 0 ; i < 256 ; i++)
@@ -211,6 +251,44 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
211
251
212
252
} // end of colours256
213
253
254
+ // -----------------------------------------------------------------------
255
+ // ansi
256
+ // -----------------------------------------------------------------------
257
+ if (strcmp (Command, " ansi" ) == 0 )
258
+ {
259
+
260
+ int i;
261
+
262
+ Note (TFormat (" %-24s %-24s %-24s" , " Name" , " On normal background" , " Under normal text" ));
263
+ Note (" ------------------------ ------------------------ ------------------------ " );
264
+
265
+ for (i = 0 ; i < 8 ; i++)
266
+ {
267
+ CString strName = TFormat (" Normal #%i (%s)" , i, sColourNames [i]);
268
+ ShowAnsiColour (this , strName, m_normalcolour [i]);
269
+ } // end for loop
270
+
271
+ for (i = 0 ; i < 8 ; i++)
272
+ {
273
+ CString strName = TFormat (" Bold #%i (%s)" , i, sColourNames [i]);
274
+ ShowAnsiColour (this , strName, m_boldcolour [i]);
275
+ } // end for loop
276
+
277
+ } // end of ansi
278
+
279
+ // -----------------------------------------------------------------------
280
+ // custom_colour
281
+ // -----------------------------------------------------------------------
282
+ if (strcmp (Command, " custom_colours" ) == 0 || strcmp (Command, " custom_colors" ) == 0 )
283
+ {
284
+ int i;
285
+ for (i = 0 ; i < MAX_CUSTOM; i++)
286
+ {
287
+ CString strName = TFormat (" Custom #%2i (%s)" , i + 1 , m_strCustomColourName [i]);
288
+ ColourNote ( ColourToName (m_customtext [i]), ColourToName (m_customback [i]), strName);
289
+ } // end for loop
290
+ } // end of custom_colour
291
+
214
292
// -----------------------------------------------------------------------
215
293
// entities
216
294
// -----------------------------------------------------------------------
@@ -1374,10 +1452,12 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
1374
1452
Note (" actions" );
1375
1453
Note (" aliases" );
1376
1454
Note (" alpha_options" );
1455
+ Note (" ansi" );
1377
1456
Note (" arrays" );
1378
- Note (" colours" );
1379
- Note (" colours256" );
1457
+ Note (" colours (or colors) " );
1458
+ Note (" colours256 (or colors256) " );
1380
1459
Note (" commands" );
1460
+ Note (" custom_colours (or custom_colors)" );
1381
1461
Note (" entities" );
1382
1462
Note (" global_options" );
1383
1463
Note (" included_options" );
0 commit comments