[fpc-devel] Compiler message colour scheme

J. Gareth Moreton gareth at moreton-family.com
Sun Nov 22 19:17:43 CET 2020


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 /not/ 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.

So, my complaint is dropped!

Gareth aka. Kit

On 22/11/2020 17:09, J. Gareth Moreton via fpc-devel wrote:
> 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!
>
> Gareth aka. Kit
>
> On 22/11/2020 16:58, Ryan Joseph via fpc-devel wrote:
>>
>>> On Nov 22, 2020, at 9:29 AM, Florian Klämpfl via fpc-devel 
>>> <fpc-devel at lists.freepascal.org> wrote:
>>>
>>> Because I have no Mac so I couldn't test it.
>> I see. It's this easy.
>>
>> const
>>    ANSI_FORE_BLACK           = 30;
>>    ANSI_FORE_RED             = 31;
>>    ANSI_FORE_GREEN           = 32;
>>    ANSI_FORE_YELLOW          = 33;
>>    ANSI_FORE_BLUE            = 34;
>>    ANSI_FORE_MAGENTA         = 35;
>>    ANSI_FORE_CYAN            = 36;
>>    ANSI_FORE_WHITE           = 37;
>>    ANSI_FORE_RESET           = 39;
>>
>>    ANSI_BACK_BLACK           = 40;
>>    ANSI_BACK_RED             = 41;
>>    ANSI_BACK_GREEN           = 42;
>>    ANSI_BACK_YELLOW          = 43;
>>    ANSI_BACK_BLUE            = 44;
>>    ANSI_BACK_MAGENTA         = 45;
>>    ANSI_BACK_CYAN            = 46;
>>    ANSI_BACK_WHITE           = 47;
>>    ANSI_BACK_RESET           = 49;
>>
>>    ANSI_STYLE_BOLD           = 1;
>>    ANSI_STYLE_ITALIC         = 3;
>>    ANSI_STYLE_UNDERLINE      = 4;
>>    ANSI_STYLE_BLINK          = 5;
>>
>>
>> procedure PrintColor(codes: array of byte; str: ansistring);
>> var
>>    attrs: string;
>>    code: byte;
>> begin
>>    attrs := '';
>>    for code in codes do
>>      begin
>>        if attrs <> '' then
>>          attrs += ';';
>>        attrs += IntToStr(code);
>>      end;
>>    writeln(#&033,'[',attrs,'m',str,#&033,'[',0,'m');
>> end;
>>
>> // prints a blinking, bold red text on a white background
>> PrintColor([ANSI_BACK_WHITE, ANSI_FORE_RED, ANSI_STYLE_BLINK, 
>> ANSI_STYLE_BOLD], 'Hello World');
>>
>> Regards,
>>     Ryan Joseph
>>
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>>
>


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20201122/24750991/attachment.htm>


More information about the fpc-devel mailing list