<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>But to go back to the point I originally raised, Kirinn raised a
good point about those who have white rather than black
backgrounds, or any colour so long as it's <i>not</i> black!
Yellow is very hard to see against a bright white backdrop, while
red, medium/dark green and magenta can be seen on most
backgrounds. Plus GCC uses the same colours for warnings.<br>
</p>
<p>So, my complaint is dropped!<br>
</p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 22/11/2020 17:09, J. Gareth Moreton
via fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:43514286-d49d-425e-c28d-ff088b1300b3@moreton-family.com">Personally
I'd write the function as something like "function
GenerateColorCode(codes: array of Byte): ansistring;", mostly in
anticipation of pure functions, because then the compiler can just
replace the call with the relevant string at compile time, but
that's a long way off!
<br>
<br>
Gareth aka. Kit
<br>
<br>
On 22/11/2020 16:58, Ryan Joseph via fpc-devel wrote:
<br>
<blockquote type="cite">
<br>
<blockquote type="cite">On Nov 22, 2020, at 9:29 AM, Florian
Klämpfl via fpc-devel <a class="moz-txt-link-rfc2396E" href="mailto:fpc-devel@lists.freepascal.org"><fpc-devel@lists.freepascal.org></a>
wrote:
<br>
<br>
Because I have no Mac so I couldn't test it.
<br>
</blockquote>
I see. It's this easy.
<br>
<br>
const
<br>
ANSI_FORE_BLACK = 30;
<br>
ANSI_FORE_RED = 31;
<br>
ANSI_FORE_GREEN = 32;
<br>
ANSI_FORE_YELLOW = 33;
<br>
ANSI_FORE_BLUE = 34;
<br>
ANSI_FORE_MAGENTA = 35;
<br>
ANSI_FORE_CYAN = 36;
<br>
ANSI_FORE_WHITE = 37;
<br>
ANSI_FORE_RESET = 39;
<br>
<br>
ANSI_BACK_BLACK = 40;
<br>
ANSI_BACK_RED = 41;
<br>
ANSI_BACK_GREEN = 42;
<br>
ANSI_BACK_YELLOW = 43;
<br>
ANSI_BACK_BLUE = 44;
<br>
ANSI_BACK_MAGENTA = 45;
<br>
ANSI_BACK_CYAN = 46;
<br>
ANSI_BACK_WHITE = 47;
<br>
ANSI_BACK_RESET = 49;
<br>
<br>
ANSI_STYLE_BOLD = 1;
<br>
ANSI_STYLE_ITALIC = 3;
<br>
ANSI_STYLE_UNDERLINE = 4;
<br>
ANSI_STYLE_BLINK = 5;
<br>
<br>
<br>
procedure PrintColor(codes: array of byte; str: ansistring);
<br>
var
<br>
attrs: string;
<br>
code: byte;
<br>
begin
<br>
attrs := '';
<br>
for code in codes do
<br>
begin
<br>
if attrs <> '' then
<br>
attrs += ';';
<br>
attrs += IntToStr(code);
<br>
end;
<br>
writeln(#&033,'[',attrs,'m',str,#&033,'[',0,'m');
<br>
end;
<br>
<br>
// prints a blinking, bold red text on a white background
<br>
PrintColor([ANSI_BACK_WHITE, ANSI_FORE_RED, ANSI_STYLE_BLINK,
ANSI_STYLE_BOLD], 'Hello World');
<br>
<br>
Regards,
<br>
Ryan Joseph
<br>
<br>
_______________________________________________
<br>
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
<br>
<br>
</blockquote>
<br>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>