Skip to content

Commit b1d4658

Browse files
committed
Support "dark" draw option for histogram
Only for the debugging purposes
1 parent 71a482c commit b1d4658

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

modules/gpad/TPadPainter.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class TPadPainter extends ObjectPainter {
500500
.style("bottom", 0);
501501
}
502502

503-
svg.style("filter", settings.DarkMode ? "invert(100%)" : null);
503+
svg.style("filter", settings.DarkMode || this.pad?.$dark ? "invert(100%)" : null);
504504

505505
svg.attr("viewBox", `0 0 ${rect.width} ${rect.height}`)
506506
.attr("preserveAspectRatio", "none") // we do not preserve relative ratio

modules/hist2d/THistPainter.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ class THistDrawOptions {
305305
return false;
306306
};
307307

308+
if (d.check('DARK')) this.darkMode = true;
309+
308310
if (d.check('FILL_', true) && d.getColor())
309311
this.histoFillColor = d.color;
310312

@@ -1181,6 +1183,9 @@ class THistPainter extends ObjectPainter {
11811183
fp.createXY2(opts);
11821184

11831185
return fp.drawAxes2(opts.second_x, opts.second_y);
1186+
} else if (this.options.darkMode) {
1187+
let pp = this.getPadPainter();
1188+
if (pp?.changeDarkMode) pp.changeDarkMode(true);
11841189
}
11851190

11861191
if (this.options.adjustFrame) {
@@ -2236,7 +2241,7 @@ class THistPainter extends ObjectPainter {
22362241
if (handle.kind === 'time')
22372242
return funcs.axisAsText(name, (x1+x2)/2);
22382243

2239-
return "[" + funcs.axisAsText(name, x1) + ", " + funcs.axisAsText(name, x2) + ")";
2244+
return `[${funcs.axisAsText(name, x1)}, ${funcs.axisAsText(name, x2)})`;
22402245
}
22412246

22422247
/** @summary generic draw function for histograms

0 commit comments

Comments
 (0)