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)
{
auto qColorToAnsiCode = [] (const QColor &color) {
return QString::fromLatin1("\033[38;2;%1;%2;%3m")
.arg(color.red()).arg(color.green()).arg(color.blue());
};
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);
static const QString prefix
= ansiColoredText(Constants::OUTPUT_PREFIX, creatorTheme()->color(Theme::Token_Text_Muted));
return prefix + str;
}
QStringList addCMakePrefix(const QStringList &list)