Switch body class from theme--light to theme--dark and theme--breezedark when theme is active. Fixes #228 (#237)

This commit is contained in:
Magnus Walbeck 2021-03-19 18:07:12 +01:00 committed by GitHub
parent 61427e52c7
commit d689bf1b8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- [#235](https://github.com/mwalbeck/nextcloud-breeze-dark/issues/235) Polish translation. Thanks @Valdnet
- [#236](https://github.com/mwalbeck/nextcloud-breeze-dark/issues/236) Transifex config
- [#228](https://github.com/mwalbeck/nextcloud-breeze-dark/issues/228) Switch body class from theme--light to theme--dark and theme--breezedark when theme is active.
### Fixed

27
js/breezedark.js Normal file
View File

@ -0,0 +1,27 @@
/**
* Breeze Dark theme for Nextcloud
*
* @copyright Copyright (C) 2021 Magnus Walbeck <mw@mwalbeck.org>
*
* @author Magnus Walbeck <mw@mwalbeck.org>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
document.addEventListener("DOMContentLoaded", function () {
document.body.classList.add("theme--dark", "theme--breezedark");
document.body.classList.remove("theme--light");
});

View File

@ -88,6 +88,7 @@ class Application extends App implements IBootstrap {
*/
public function addStyling(IURLGenerator $urlGenerator, string $loginPage, string $cachebuster): void {
Util::addStyle($this->appName, 'server');
Util::addScript($this->appName, 'breezedark');
// If the styling for the login page is wanted, load the stylesheet.
if ($loginPage) {