[deleted] if a CSS (Less) solution works for you, you can use the same logic that Flarum uses to generate the two different theme CSS files.
https://github.com/flarum/core/blob/v0.1.0-beta.15/less/common/variables.less#L21
This is how Flarum registers its color variables to have different values based on the theme.
.define-colors(@config-dark-mode);
.define-colors(false) {
@primary-color: @config-primary-color;
}
.define-colors(true) {
@primary-color: @config-primary-color;
}
You can use the same code to conditionally define Less for light or dark mode. Just rename .define-colors to something unique to your extension. Then replace the color variables with your own color variables, or put your CSS directives directly where the color is in the example. I don't think it's required to define both false and true, so you can skip one if you don't need it.
Assuming you are using FoF Nightmode extension, I think there might be an attribute on the app.forum object you can read with javascript. If you need the information from outside a webview, you could probably inject that information into a response header with some custom code.
If none of this is applicable, what other means would you have of accessing data? I'm not familiar with the framework you're using.