Files
zulip/static/js/night_mode.js
Boris Yankov 65eb125d61 cleanup: Remove unnecessary 'magic' style for night mode.
This was introduced in e0236646

For 1.5 years we did not find a case that needed it (besides the
`a` tag hover state, that is not obvious if it was needed or it was
used as an example)

It is not obvious if this solution was a good idea. The concern was
that `body.night-mode` is more specific than `body` and some styles
might override others less specific in cases we might not want that.

Of course, we want that in the majority of cases, and css-specificity
rules are not simple to comprehend.

Good further reading:
http://cssspecificity.com/
https://specificity.keegan.st/

The added complexity of the resulting styles and the added code that
might not serve any practical purpose seem to not be worth it.
2019-03-13 12:53:30 -07:00

26 lines
434 B
JavaScript

var night_mode = (function () {
var exports = {};
exports.initialize = function () {
if (page_params.night_mode) {
exports.enable();
}
};
exports.enable = function () {
$("body").addClass("night-mode");
};
exports.disable = function () {
$("body").removeClass("night-mode");
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = night_mode;
}
window.night_mode = night_mode;