Made a change in my dashboard so there is a test performance graph visible.
In the default Dark theme, the legend text is white.
When I go for my custom theme, the legend text is also black.
So it seems It is unrelated to your svg style changes, but related to making a new theme.
I’m guessing there’s something missing in our themes to make canvas texts the white colour and it’s borrowing it from the light theme instead. Have not figured it out, but when I got the time will look into it further.
Edit:
Canvas for graphs have inline styles.
Default dark theme:
div.graph div.v_axis_label {
color: rgba(255, 255, 255, 0.8);
}
div.graph div.time {
color: rgba(255, 255, 255, 0.8);
}
div.graph table.legend th.scalar.inactive, div.graph table.legend td.scalar.inactive {
color: rgba(255, 255, 255, 0.6);
}
div.graph table.legend th {
border-bottom: 1px solid #ffffff;
}
div.graph table.legend th.scalar {
color: #ffffff;
border-bottom: 1px solid #ffffff;
}
div.graph a {
color: #ffffff;
}
div.graph.preview .title {
text-shadow: -1px 0 #000000, 0 1px #000000, 1px 0 #000000, 0 -1px #000000;
}
div.graph div.title.inline, div.graph div.time.inline {
text-shadow: -1px 0 #000000, 0 1px #000000, 1px 0 #000000, 0 -1px #000000;
}
div.graph div.indicator {
border-right: 1px dotted #ffffff;
}
Default light theme:
div.graph div.v_axis_label {
color: rgba(0, 0, 0, 0.8);
}
div.graph div.time {
color: rgba(0, 0, 0, 0.8);
}
div.graph table.legend th.scalar.inactive, div.graph table.legend td.scalar.inactive {
color: rgba(0, 0, 0, 0.6);
}
div.graph table.legend th {
border-bottom: 1px solid #000000;
}
div.graph table.legend th.scalar {
color: #000000;
border-bottom: 1px solid #000000;
}
div.graph a {
color: #000000;
}
div.graph.preview .title {
text-shadow: -1px 0 #ffffff, 0 1px #ffffff, 1px 0 #ffffff, 0 -1px #ffffff;
}
div.graph div.title.inline, div.graph div.time.inline {
text-shadow: -1px 0 #ffffff, 0 1px #ffffff, 1px 0 #ffffff, 0 -1px #ffffff;
}
div.graph div.indicator {
border-right: 1px dotted #000000;
}
New themes get default light theme inline styles assigned.
Did some quick tests with Stylus browser add on and I’m unable to override it with !important
property. )-: Maybe, I’m missing something, but currently clueless.
div.graph div.v_axis_label {
color: rgba(255, 255, 255, 0.8) !important;
}
div.graph div.time {
color: rgba(255, 255, 255, 0.8) !important;
}
div.graph table.legend th.scalar.inactive, div.graph table.legend td.scalar.inactive {
color: rgba(255, 255, 255, 0.6) !important;
}
div.graph table.legend th {
border-bottom: 1px solid #ffffff !important;
}
div.graph table.legend th.scalar {
color: #ffffff !important;
border-bottom: 1px solid #ffffff !important;
}
div.graph.preview .title {
text-shadow: -1px 0 #000000, 0 1px #000000, 1px 0 #000000, 0 -1px #000000 !important;
}
div.graph div.title.inline, div.graph div.time.inline {
text-shadow: -1px 0 #000000, 0 1px #000000, 1px 0 #000000, 0 -1px #000000 !important;
}
div.graph div.indicator {
border-right: 1px dotted #ffffff !important;
}
Edit2
The inline styles are made by main_min.js
according to following javascript snippet:
function update_graph_styling(t, e) {
var n = e.getElementsByClassName("graph")[0];
if (n) {
n.style.color = t.render_options.foreground_color;
for (var r = render_color(invert_color(parse_color(t.render_options.foreground_color))), i = document.createElement("style"), o = [{
selector: "div.graph div.v_axis_label",
attrs: {
color: render_color_rgba(parse_color(t.render_options.foreground_color), .8)
}
}, {
selector: "div.graph div.time",
attrs: {
color: render_color_rgba(parse_color(t.render_options.foreground_color), .8)
}
}, {
selector: "div.graph table.legend th.scalar.inactive, div.graph table.legend td.scalar.inactive",
attrs: {
color: render_color_rgba(parse_color(t.render_options.foreground_color), .6)
}
}, {
selector: "div.graph table.legend th",
attrs: {
"border-bottom": "1px solid " + t.render_options.foreground_color
}
}, {
selector: "div.graph table.legend th.scalar",
attrs: {
color: t.render_options.foreground_color,
"border-bottom": "1px solid " + t.render_options.foreground_color
}
}, {
selector: "div.graph a",
attrs: {
color: t.render_options.foreground_color
}
}, {
selector: "div.graph.preview .title",
attrs: {
"text-shadow": "-1px 0 " + r + ", 0 1px " + r + ", 1px 0 " + r + ", 0 -1px " + r
}
}, {
selector: "div.graph div.title.inline, div.graph div.time.inline",
attrs: {
"text-shadow": "-1px 0 " + r + ", 0 1px " + r + ", 1px 0 " + r + ", 0 -1px " + r
}
}, {
selector: "div.graph div.indicator",
attrs: {
"border-right": "1px dotted " + t.render_options.foreground_color
}
}
], a = "", s = 0, u = o.length; s < u; s++) {
var c = o[s];
for (var l in a += c.selector + " {\n", c.attrs)
a += l + ": " + c.attrs[l] + ";\n";
a += "}\n"
}
i.innerHTML = a,
n.appendChild(i)
}
}
Variable t.render_options.foreground_color
is set elsewhere. I assume it is set in the javascript before the canvas.
Sadly, my Web Developer Tools keeps crashing while I try to debug the code, so not making much progress and my weekend is starting in a bit.