From 92824cb37c604f636f9bed4e11e8096c6c4e08d5 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 26 Dec 2024 20:00:09 -0800 Subject: [PATCH] Try to fix disabled folder not showing correct color for labels. The devtools don't show any reason it wasn't already working so this is a hack to get it to work. --- examples/js/lots.js | 25 +++++++++++++++++++++++++ src/styles/muigui.css.js | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/examples/js/lots.js b/examples/js/lots.js index bea3566..da31e58 100644 --- a/examples/js/lots.js +++ b/examples/js/lots.js @@ -47,6 +47,8 @@ const getListOfUIColorCSSVariableNames = (() => { })(); getListOfUIColorCSSVariableNames(); +const range = (n, fn) => new Array(n).fill(0).map((_, i) => fn(i)); + // eslint-disable-next-line no-constant-condition if (false) { const s = { @@ -228,6 +230,29 @@ if (showUI) { } +if (showUI) { + const div = document.createElement('div'); + uiElem.appendChild(div); + const gui = new GUI({parent: div, title: 'Disabled Folder'}); + + const folders = range(3, (i) => { + const settings = { + name: 'test', + speed: 45, + toggle: true, + animal: 'bird', + }; + const folder = gui.addFolder(`folder:${i}`); + folder.add(settings, 'name'); + folder.add(settings, 'speed', 0, 100); + folder.add(settings, 'toggle'); + folder.add(settings, 'animal', ['bird', 'cat', 'dog']); + return folder; + }); + + folders[1].enable(false); +} + // Using Sliders if (showUI) { const div = document.createElement('div'); diff --git a/src/styles/muigui.css.js b/src/styles/muigui.css.js index 876733d..e96dff2 100644 --- a/src/styles/muigui.css.js +++ b/src/styles/muigui.css.js @@ -150,6 +150,10 @@ export default { --value-color: var(--disabled-color) !important; --range-left-color: var(--disabled-color) !important; } +/* this shouldn't be needed! */ +.muigui-disabled label { + color: var(--disabled-color) +} .muigui canvas, .muigui svg {