I am currently looking for a way to check whether a user has enabled the dark theme via Javascript.
What i tried so far:
- I checked the global
OC.theme
variable, but it only contains instance wide stuff like branding etc. - I sniffed the endpoint to change the theme (
PUT https://example.com/ocs/v2.php/apps/accessibility/api/v1/config/theme
) and tried to modify the request to useGET
, but it returned a405 Method not allowed
, so i assume this is a write only endpoint - I searched for existing css variables. Depending on the set colors, one could “guess” whether the dark theme is enabled or not, but this does not seem to be a deterministic reliable way
Maybe someone has a hint for me? A solution must be framework agnostic (= not depending on Vue.js
) and ideally it should not include a HTTP request (but that’s ok if there is no other way).