forked from qt-creator/qt-creator
Utils: Add function to format colored text
Change-Id: I6ae4d113e0aca434e99d9864188187100c24e47d Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -672,4 +672,10 @@ void MarkdownHighlighter::highlightBlock(const QString &text)
|
||||
}
|
||||
}
|
||||
|
||||
QString ansiColoredText(const QString &text, const QColor color)
|
||||
{
|
||||
static const QString formatString("\033[38;2;%1;%2;%3m%4\033[0m");
|
||||
return formatString.arg(color.red()).arg(color.green()).arg(color.blue()).arg(text);
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -138,4 +138,6 @@ private:
|
||||
QBrush m_codeBgBrush;
|
||||
};
|
||||
|
||||
QTCREATOR_UTILS_EXPORT QString ansiColoredText(const QString &text, const QColor color);
|
||||
|
||||
} // namespace Utils
|
||||
|
Reference in New Issue
Block a user