feat: Enhance dark mode styling and improve dropdown menu behavior for better user experience
This commit is contained in:
@@ -524,6 +524,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Set Chart.js default font/color from CSS variables so charts match theme
|
||||
(function(){
|
||||
try {
|
||||
var root = getComputedStyle(document.documentElement);
|
||||
var cssColor = root.getPropertyValue('--ots-text') || root.getPropertyValue('--color-text-primary') || root.getPropertyValue('--color-text');
|
||||
cssColor = (cssColor || '').trim() || '#ffffff';
|
||||
if (window.Chart && Chart.defaults) {
|
||||
// Chart.js v3+ uses Chart.defaults.color
|
||||
if (typeof Chart.defaults.color !== 'undefined') Chart.defaults.color = cssColor;
|
||||
// Backwards compatibility for older Chart.js
|
||||
if (Chart.defaults.global) Chart.defaults.global.defaultFontColor = cssColor;
|
||||
if (Chart.defaults.font) Chart.defaults.font.color = cssColor;
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
})();
|
||||
|
||||
var bandwidthChart = new Chart($("#bandwidthChart"), {
|
||||
type: "line",
|
||||
data: {{ bandwidthWidget|raw }},
|
||||
|
||||
Reference in New Issue
Block a user