diff --git a/include/app/SvgPort.hpp b/include/app/SvgPort.hpp index 12643986..c3848880 100644 --- a/include/app/SvgPort.hpp +++ b/include/app/SvgPort.hpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace rack { @@ -26,5 +27,22 @@ struct SvgPort : PortWidget { DEPRECATED typedef SvgPort SVGPort; +struct ThemedSvgPort : SvgPort { + std::shared_ptr lightSvg; + std::shared_ptr darkSvg; + + void setSvg(std::shared_ptr lightSvg, std::shared_ptr darkSvg) { + this->lightSvg = lightSvg; + this->darkSvg = darkSvg; + SvgPort::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg); + } + + void step() override { + SvgPort::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg); + SvgPort::step(); + } +}; + + } // namespace app } // namespace rack diff --git a/include/componentlibrary.hpp b/include/componentlibrary.hpp index 2ac524c5..91eebc18 100644 --- a/include/componentlibrary.hpp +++ b/include/componentlibrary.hpp @@ -785,6 +785,12 @@ struct PJ301MPort : app::SvgPort { } }; +struct ThemedPJ301MPort : app::ThemedSvgPort { + ThemedPJ301MPort() { + setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ301M.svg")), Svg::load(asset::system("res/ComponentLibrary/PJ301M-dark.svg"))); + } +}; + struct PJ3410Port : app::SvgPort { PJ3410Port() { setSvg(Svg::load(asset::system("res/ComponentLibrary/PJ3410.svg"))); diff --git a/res/ComponentLibrary/PJ301M-dark.svg b/res/ComponentLibrary/PJ301M-dark.svg new file mode 100644 index 00000000..a042c300 --- /dev/null +++ b/res/ComponentLibrary/PJ301M-dark.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +