[Qt-creator] About ANSI color support for Qt-creator output panel

Xiaofeng Wu djangowu at gmail.com
Sat Dec 27 16:13:41 CET 2014


Now the output is
"Hello World"
with code,
std::cout << "\x1b[32mHello \x1b[34mWorld\x1b[m" << std::endl;

Best,
Xiaofeng

On Sat, Dec 27, 2014 at 9:56 AM, Petar Perisin <petar.perisin at gmail.com>
wrote:

> It seems like ansiescapecodehandler.cpp defines escape as
>
> \x1b[
>
> so try that instead of '\e['
>
> try simple colors for start, like
>
> \x1b[32mHello \x1b[34mWorld\x1b[m
>
> or something similar.
>
>
> Regards,
> Petar
>
>
>
> On Sat, Dec 27, 2014 at 3:43 PM, Xiaofeng Wu <djangowu at gmail.com> wrote:
>
>> Hi,
>>
>> I tried double the backslash with code
>> std::cout << "\\e[38;5;82mHello \\e[38;5;198mWorld" << std::endl;,
>>  the output is like
>> "\e[38;5;82mHello \e[38;5;198mWorld"
>> Any other suggestion for making it work correctly?
>>
>> Thanks,
>> Xiaofeng
>>
>> On Sat, Dec 27, 2014 at 9:14 AM, Petar Perisin <petar.perisin at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I haven't tried, but try to double the backslash:
>>>
>>> std::cout << “\\e[38;5;82mHello \\e[38;5;198mWorld” << std::endl;
>>>
>>> also, you might need to end colors somewhere.
>>>
>>> Regards,
>>> Petar
>>>
>>> On Sat, Dec 27, 2014 at 3:34 AM, Xiaofeng Wu <djangowu at gmail.com> wrote:
>>>
>>>> In the change log of Qt Creator 3.3.0, it says the application output
>>>> panel support ansi color.
>>>> But when I try to print colored texts like
>>>>
>>>> std::cout << “\e[38;5;82mHello \e[38;5;198mWorld” << std::endl;
>>>>
>>>> What I can see from the application output panel is the verbatim output
>>>> of the string, instead of colored text of “Hello Wolrd”
>>>>
>>>> Am I using it in the wrong way?
>>>>
>>>> _______________________________________________
>>>> Qt-creator mailing list
>>>> Qt-creator at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20141227/1551d367/attachment.html>


More information about the Qt-creator mailing list