Move color mode selection JS out of base template #5775

Closed
opened 2025-12-29 19:32:33 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Dec 14, 2021).

Originally assigned to: @arthanson on GitHub.

Proposed Changes

There are around sixty lines of Javascript in the base template (base.html) which infer and set the UI color mode (light or dark). The bulk of this code should be moved into netbox.js or, if necessary, a separate Javascript file.

Justification

This code is re-transmitted to the client on each request. Serving it from a separate static resource (which can be cached by the browser) is more efficient and reduces noise in the base template.

Originally created by @jeremystretch on GitHub (Dec 14, 2021). Originally assigned to: @arthanson on GitHub. ### Proposed Changes There are around sixty lines of Javascript in the base template (`base.html`) which infer and set the UI color mode (light or dark). The bulk of this code should be moved into `netbox.js` or, if necessary, a separate Javascript file. ### Justification This code is re-transmitted to the client on each request. Serving it from a separate static resource (which can be cached by the browser) is more efficient and reduces noise in the base template.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 19:32:33 +01:00
adam closed this issue 2025-12-29 19:32:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5775