CMake: Use theme colors for text prefix

Also uses new Utils::ansiColoredText() function.

Change-Id: I43e59f78eb47903fc273244a9cd4e9da9b68839f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-05-07 07:51:08 +02:00
parent 770f1b0376
commit dced7ce913

View File

@@ -177,16 +177,9 @@ void CMakeProcess::stop()
QString addCMakePrefix(const QString &str) QString addCMakePrefix(const QString &str)
{ {
auto qColorToAnsiCode = [] (const QColor &color) { static const QString prefix
return QString::fromLatin1("\033[38;2;%1;%2;%3m") = ansiColoredText(Constants::OUTPUT_PREFIX, creatorTheme()->color(Theme::Token_Text_Muted));
.arg(color.red()).arg(color.green()).arg(color.blue()); return prefix + str;
};
static const QColor bgColor = creatorTheme()->color(Theme::BackgroundColorNormal);
static const QColor fgColor = creatorTheme()->color(Theme::TextColorNormal);
static const QColor grey = StyleHelper::mergedColors(fgColor, bgColor, 80);
static const QString prefixString = qColorToAnsiCode(grey) + Constants::OUTPUT_PREFIX
+ qColorToAnsiCode(fgColor);
return QString("%1%2").arg(prefixString, str);
} }
QStringList addCMakePrefix(const QStringList &list) QStringList addCMakePrefix(const QStringList &list)