From 7f65a510e838e9d092ddd5c330c0f886553adc50 Mon Sep 17 00:00:00 2001 From: IonutMuthi Date: Fri, 20 Dec 2024 02:29:02 -0500 Subject: [PATCH] regmap: add list of colors for values of the regmap Signed-off-by: IonutMuthi --- gui/style/json/global.json | 16 ++++++++++++++++ plugins/regmap/src/regmapstylehelper.cpp | 14 +++++++++++++- plugins/regmap/src/regmapstylehelper.hpp | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gui/style/json/global.json b/gui/style/json/global.json index 2eac1689d2..58d8328dd3 100644 --- a/gui/style/json/global.json +++ b/gui/style/json/global.json @@ -31,5 +31,21 @@ "ch7": "#c7c10a", "white": "#FFFFFF", "black": "#000000", +"regmap_value_color_0": "#FF0000", +"regmap_value_color_1": "#00FF00", +"regmap_value_color_2": "#E76423", +"regmap_value_color_3": "#B16EE0", +"regmap_value_color_4": "#2E9E6F", +"regmap_value_color_5": "#3A8EE9", +"regmap_value_color_6": "#F64C5A", +"regmap_value_color_7": "#1694CA", +"regmap_value_color_8": "#E84DB4", +"regmap_value_color_9": "#0000FF", +"regmap_value_color_10": "#FFFF00", +"regmap_value_color_11": "#00FFFF", +"regmap_value_color_12": "#FF00FF", +"regmap_value_color_13": "#8B4513", +"regmap_value_color_14": "#8A2BE2", +"regmap_value_color_15": "#DEB887", "run_button_color": "&interactive_primary_idle&" } diff --git a/plugins/regmap/src/regmapstylehelper.cpp b/plugins/regmap/src/regmapstylehelper.cpp index 26d19e6b9e..64592d7d6d 100644 --- a/plugins/regmap/src/regmapstylehelper.cpp +++ b/plugins/regmap/src/regmapstylehelper.cpp @@ -204,5 +204,17 @@ void RegmapStyleHelper::smallBlueButton(QPushButton *button, QString objectName) QString RegmapStyleHelper::getColorBasedOnValue(QString value) { uint32_t colorIndex = Utils::convertQStringToUint32(value) % 16; - return StyleHelper::getChannelColor(colorIndex); + return RegmapStyleHelper::getRegmapValueColor(colorIndex); +} + +QString RegmapStyleHelper::getRegmapValueColor(int index) +{ + if(index <= 15) { + QString regmapValueColorString = "regmap_value_color_"; + QColor color = Style::getAttribute( + QString(regmapValueColorString + QString::number(index)).toStdString().c_str()); + return color.name(); + } else { + return ""; + } } diff --git a/plugins/regmap/src/regmapstylehelper.hpp b/plugins/regmap/src/regmapstylehelper.hpp index e10fcc6a65..acd3c2fb38 100644 --- a/plugins/regmap/src/regmapstylehelper.hpp +++ b/plugins/regmap/src/regmapstylehelper.hpp @@ -70,6 +70,7 @@ class RegmapStyleHelper private: QMap colorMap; static RegmapStyleHelper *pinstance_; + static QString getRegmapValueColor(int index); }; } // namespace scopy::regmap #endif // REGMAPSTYLEHELPER_HPP