-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
NetBox version
v4.1.4
Feature type
Change to existing functionality
Triage priority
I volunteer to perform this work (if approved)
Proposed functionality
-
Emit
CustomEvent
on Color Mode Change. An event-driven workflow will simplify color mode handling for plugins and decouple it from any existing UI elements. This should involve only a single-line addition innetbox/project-static/src/colorMode.ts
:export function setColorMode(mode: ColorMode): void { storeColorMode(mode); updateElements(mode); window.dispatchEvent(new CustomEvent('netbox.colorModeChanged', { netboxColorMode: mode })); }
-
Update the Plugin Development Guide. Document how the color mode can be detected on load using
window.localStorage['netbox-color-mode']
and managed on change using the proposed event-driven approach.
Use case
This functionality should allow plugins to dynamically update visual elements, such as images, that don’t currently adjust with color mode changes. Additionally, since color mode behavior is undocumented, standardizing this would improve consistency across plugins and streamline plugin development.
Database changes
No.
External dependencies
No.