diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp index 490951cbc..663647cf1 100644 --- a/NeuralAmpModeler/NeuralAmpModeler.cpp +++ b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -22,6 +22,8 @@ using namespace igraphics; const double kDCBlockerFrequency = 5.0; +iplug::igraphics::IColor NAM_CUSTOMTHEMECOLOR = PluginColors::NAM_THEMECOLOR; + // Styles const IVColorSpec colorSpec{ DEFAULT_BGCOLOR, // Background @@ -414,6 +416,7 @@ bool NeuralAmpModeler::SerializeState(IByteChunk& chunk) const // when we unserialize) chunk.PutStr(mNAMPath.Get()); chunk.PutStr(mIRPath.Get()); + chunk.PutStr(mHighLightColor.Get()); return SerializeParams(chunk); } @@ -459,6 +462,20 @@ void NeuralAmpModeler::OnUIOpen() { _UpdateControlsFromModel(); } + + GetUI()->ForStandardControlsFunc([&](IControl* pControl) { + if (auto* pVectorBase = pControl->As()) + { + if (mHighLightColor.GetLength()) + NAM_CUSTOMTHEMECOLOR = IColor::FromColorCodeStr(mHighLightColor.Get()); + + pVectorBase->SetColor(kX1, NAM_CUSTOMTHEMECOLOR); + pVectorBase->SetColor(kPR, NAM_CUSTOMTHEMECOLOR.WithOpacity(0.6f)); + pVectorBase->SetColor(kFR, NAM_CUSTOMTHEMECOLOR.WithOpacity(0.1f)); + pVectorBase->SetColor(kX3, NAM_CUSTOMTHEMECOLOR.WithContrast(0.1f)); + } + pControl->GetUI()->SetAllControlsDirty(); + }); } void NeuralAmpModeler::OnParamChange(int paramIdx) @@ -513,12 +530,12 @@ bool NeuralAmpModeler::OnMessage(int msgTag, int ctrlTag, int dataSize, const vo GetUI()->ForStandardControlsFunc([&](IControl* pControl) { if (auto* pVectorBase = pControl->As()) { - IColor color = IColor::FromColorCodeStr(mHighLightColor.Get()); + NAM_CUSTOMTHEMECOLOR = IColor::FromColorCodeStr(mHighLightColor.Get()); - pVectorBase->SetColor(kX1, color); - pVectorBase->SetColor(kPR, color.WithOpacity(0.3f)); - pVectorBase->SetColor(kFR, color.WithOpacity(0.4f)); - pVectorBase->SetColor(kX3, color.WithContrast(0.1f)); + pVectorBase->SetColor(kX1, NAM_CUSTOMTHEMECOLOR); + pVectorBase->SetColor(kPR, NAM_CUSTOMTHEMECOLOR.WithOpacity(0.6f)); + pVectorBase->SetColor(kFR, NAM_CUSTOMTHEMECOLOR.WithOpacity(0.1f)); + pVectorBase->SetColor(kX3, NAM_CUSTOMTHEMECOLOR.WithContrast(0.1f)); } pControl->GetUI()->SetAllControlsDirty(); }); diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h index f85db74cc..e04ac9b71 100644 --- a/NeuralAmpModeler/NeuralAmpModelerControls.h +++ b/NeuralAmpModeler/NeuralAmpModelerControls.h @@ -706,6 +706,23 @@ class NAMSettingsPageControl : public IContainerBaseWithNamedChildren outputModeControl->SetTooltip( "How to adjust the level of the output.\nRaw=No adjustment.\nNormalized=Adjust the level so that all models " "are about the same loudness.\nCalibrated=Match the input's digital-analog calibration."); + + // Attach highlight color controls + const auto colorArea = + titleArea.GetFromTop(0.5f * height).GetFromLeft(0.5f * width).GetTranslated(0.0f, 47.0f); + const auto highlightArea = colorArea.GetFromLeft(0.5f * width).GetHPadded(-92.0f).GetVPadded(-15.0f); + ; + AddNamedChildControl( + new IVColorSwatchControl(highlightArea, "Highlight Color", + [&](int idx, IColor color) { + WDL_String colorCodeStr; + color.ToColorCodeStr(colorCodeStr, false); + this->GetDelegate()->SendArbitraryMsgFromUI( + kMsgTagHighlightColor, kNoTag, colorCodeStr.GetLength(), colorCodeStr.Get()); + }, + mStyle, IVColorSwatchControl::ECellLayout::kHorizontal, { kX1 }, { "" }), + mControlNames.highlightColor) + ->SetTooltip("choose your favorite color \nfor the plugin controls"); } const float halfWidth = PLUG_WIDTH / 2.0f - pad; @@ -754,6 +771,7 @@ class NAMSettingsPageControl : public IContainerBaseWithNamedChildren const std::string modelInfo = "ModelInfo"; const std::string outputMode = "OutputMode"; const std::string title = "Title"; + const std::string highlightColor = "Highlight Color"; } mControlNames; class InputLevelControl : public IEditableTextControl diff --git a/NeuralAmpModeler/Unserialization.cpp b/NeuralAmpModeler/Unserialization.cpp index 5833d3ff9..631323648 100644 --- a/NeuralAmpModeler/Unserialization.cpp +++ b/NeuralAmpModeler/Unserialization.cpp @@ -56,6 +56,7 @@ void NeuralAmpModeler::_UnserializeApplyConfig(nlohmann::json& config) mNAMPath.Set(static_cast(config["NAMPath"]).c_str()); mIRPath.Set(static_cast(config["IRPath"]).c_str()); + mHighLightColor.Set(static_cast(config["HighLightColor"]).c_str()); if (mNAMPath.GetLength()) { @@ -77,6 +78,8 @@ int _UnserializePathsAndExpectedKeys(const iplug::IByteChunk& chunk, int startPo config["NAMPath"] = std::string(path.Get()); pos = chunk.GetStr(path, pos); config["IRPath"] = std::string(path.Get()); + pos = chunk.GetStr(path, pos); + config["HighLightColor"] = std::string(path.Get()); for (auto it = paramNames.begin(); it != paramNames.end(); ++it) {