MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / loadWhiteFillIcon

Function loadWhiteFillIcon

pj_app/src/PreferencesDialog.cpp:53–67  ·  view source on GitHub ↗

The toggle's track is gray (off) ↔ blue (on); the baked `#3D3D3D` fill on the sun/moon SVGs reads as muddy dark-gray-on-blue. Recolor to pure white at load time so the glyphs pop against either track tone. Used only here — keep it local rather than promoting a helper.

Source from the content-addressed store, hash-verified

51// to pure white at load time so the glyphs pop against either track
52// tone. Used only here — keep it local rather than promoting a helper.
53QIcon loadWhiteFillIcon(const QString& resource_path) {
54 QFile file(resource_path);
55 if (!file.open(QFile::ReadOnly | QFile::Text)) {
56 return {};
57 }
58 QByteArray svg = file.readAll();
59 svg.replace("#3D3D3D", "#FFFFFF");
60 QSvgRenderer renderer(svg);
61 QImage image(64, 64, QImage::Format_ARGB32);
62 image.fill(Qt::transparent);
63 QPainter painter(&image);
64 renderer.render(&painter);
65 painter.end();
66 return QIcon(QPixmap::fromImage(image));
67}
68
69} // namespace
70

Callers 1

PreferencesDialogMethod · 0.85

Calls 3

openMethod · 0.80
renderMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected