diff --git a/include/util/color.hpp b/include/util/color.hpp index 92b52a48..818671a1 100644 --- a/include/util/color.hpp +++ b/include/util/color.hpp @@ -15,19 +15,19 @@ inline NVGcolor colorClip(NVGcolor a) { } inline NVGcolor colorMinus(NVGcolor a, NVGcolor b) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) a.rgba[i] -= b.rgba[i]; return a; } inline NVGcolor colorPlus(NVGcolor a, NVGcolor b) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) a.rgba[i] += b.rgba[i]; return a; } inline NVGcolor colorMult(NVGcolor a, float x) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) a.rgba[i] *= x; return a; } diff --git a/include/window.hpp b/include/window.hpp index 0594b888..5cf1fd80 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -43,6 +43,7 @@ void windowSetWindowSize(Vec size); Vec windowGetWindowPos(); void windowSetWindowPos(Vec pos); bool windowIsMaximized(); +void windowSetTheme(NVGcolor bg, NVGcolor fg); } // namespace rack diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index 64972326..906f7bb9 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -71,7 +71,7 @@ void RackScene::step() { // Version popup message if (!newVersion.empty()) { - std::string versionMessage = stringf("Rack v%s is available.\n\nYou have Rack v%s.\n\nWould you like to download the new version on the website?", newVersion.c_str(), gApplicationVersion.c_str()); + std::string versionMessage = stringf("Rack %s is available.\n\nYou have Rack %s.\n\nWould you like to download the new version on the website?", newVersion.c_str(), gApplicationVersion.c_str()); if (osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, versionMessage.c_str())) { std::thread t(openBrowser, "https://vcvrack.com/"); t.detach(); diff --git a/src/window.cpp b/src/window.cpp index 24515632..17a63f99 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1,6 +1,7 @@ #include "window.hpp" #include "app.hpp" #include "asset.hpp" +#include "util/color.hpp" #include #include @@ -386,12 +387,7 @@ void windowInit() { bndSetFont(gGuiFont->handle); // bndSetIconImage(loadImage(assetGlobal("res/icons.png"))); - // Blendish style - BNDtheme theme; - theme = *bndGetTheme(); - theme.nodeTheme.nodeBackdropColor = theme.menuTheme.innerColor; - theme.nodeTheme.nodeBackdropColor.a = 1.0; - bndSetTheme(theme); + windowSetTheme(nvgRGB(0x40, 0x40, 0x40), nvgRGB(0xf0, 0xf0, 0xf0)); } void windowDestroy() { @@ -547,6 +543,49 @@ bool windowIsMaximized() { return glfwGetWindowAttrib(gWindow, GLFW_MAXIMIZED); } +void windowSetTheme(NVGcolor bg, NVGcolor fg) { + // Assume dark background and light foreground + + BNDwidgetTheme w; + w.outlineColor = bg; + w.itemColor = fg; + w.innerColor = bg; + w.innerSelectedColor = colorPlus(bg, nvgRGB(0x30, 0x30, 0x30)); + w.textColor = fg; + w.textSelectedColor = fg; + w.shadeTop = 0; + w.shadeDown = 0; + + BNDwidgetTheme sliderW = w; + sliderW.itemColor = bg; + sliderW.innerColor = colorPlus(bg, nvgRGB(0x50, 0x50, 0x50)); + sliderW.innerSelectedColor = colorPlus(bg, nvgRGB(0x60, 0x60, 0x60)); + + BNDwidgetTheme textW = sliderW; + textW.textColor = colorMinus(bg, nvgRGB(0x20, 0x20, 0x20)); + textW.textSelectedColor = colorMinus(bg, nvgRGB(0x20, 0x20, 0x20)); + + BNDwidgetTheme scrollW = w; + scrollW.itemColor = colorPlus(bg, nvgRGB(0x50, 0x50, 0x50)); + scrollW.innerColor = bg; + + BNDtheme t; + t.backgroundColor = colorPlus(bg, nvgRGB(0x30, 0x30, 0x30)); + t.regularTheme = w; + t.toolTheme = w; + t.radioTheme = w; + t.textFieldTheme = textW; + t.optionTheme = w; + t.choiceTheme = w; + t.numberFieldTheme = w; + t.sliderTheme = sliderW; + t.scrollBarTheme = scrollW; + t.tooltipTheme = w; + t.menuTheme = w; + t.menuItemTheme = w; + + bndSetTheme(t); +} ////////////////////