Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-04-27 20:39:36 +0300
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-04-28 09:41:58 +0300
commit4a646789c37eda99d431de84a2c4c5fed6c46152 (patch)
treef3cca2ce60d5fb4901947dcd848374c20883d0c0 /apps/theming/lib
parent971e224ce47636e828ee9d2d8003d067bc3da0da (diff)
Add system/light themes
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Service/ThemesService.php3
-rw-r--r--apps/theming/lib/Themes/DefaultTheme.php6
-rw-r--r--apps/theming/lib/Themes/LightTheme.php61
3 files changed, 67 insertions, 3 deletions
diff --git a/apps/theming/lib/Service/ThemesService.php b/apps/theming/lib/Service/ThemesService.php
index 01ebc3fb504..43977721e76 100644
--- a/apps/theming/lib/Service/ThemesService.php
+++ b/apps/theming/lib/Service/ThemesService.php
@@ -29,6 +29,7 @@ use OCA\Theming\Themes\DarkTheme;
use OCA\Theming\Themes\DefaultTheme;
use OCA\Theming\Themes\DyslexiaFont;
use OCA\Theming\Themes\HighContrastTheme;
+use OCA\Theming\Themes\LightTheme;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserSession;
@@ -43,6 +44,7 @@ class ThemesService {
public function __construct(IUserSession $userSession,
IConfig $config,
DefaultTheme $defaultTheme,
+ LightTheme $lightTheme,
DarkTheme $darkTheme,
HighContrastTheme $highContrastTheme,
DarkHighContrastTheme $darkHighContrastTheme,
@@ -53,6 +55,7 @@ class ThemesService {
// Register themes
$this->themesProviders = [
$defaultTheme->getId() => $defaultTheme,
+ $lightTheme->getId() => $lightTheme,
$darkTheme->getId() => $darkTheme,
$highContrastTheme->getId() => $highContrastTheme,
$darkHighContrastTheme->getId() => $darkHighContrastTheme,
diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php
index 191cb5814af..b13e481907a 100644
--- a/apps/theming/lib/Themes/DefaultTheme.php
+++ b/apps/theming/lib/Themes/DefaultTheme.php
@@ -67,15 +67,15 @@ class DefaultTheme implements ITheme {
}
public function getTitle(): string {
- return $this->l->t('Light theme');
+ return $this->l->t('System default theme');
}
public function getEnableLabel(): string {
- return $this->l->t('Enable the default light theme');
+ return $this->l->t('Enable the system default');
}
public function getDescription(): string {
- return $this->l->t('The default light appearance.');
+ return $this->l->t('Using the default system appearance.');
}
public function getMediaQuery(): string {
diff --git a/apps/theming/lib/Themes/LightTheme.php b/apps/theming/lib/Themes/LightTheme.php
new file mode 100644
index 00000000000..e988f612226
--- /dev/null
+++ b/apps/theming/lib/Themes/LightTheme.php
@@ -0,0 +1,61 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @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/>.
+ *
+ */
+namespace OCA\Theming\Themes;
+
+use OCA\Theming\ImageManager;
+use OCA\Theming\ThemingDefaults;
+use OCA\Theming\Util;
+use OCA\Theming\ITheme;
+use OCA\Theming\Themes\DefaultTheme;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+
+class LightTheme extends DefaultTheme implements ITheme {
+
+ public function getId(): string {
+ return 'light';
+ }
+
+ public function getType(): int {
+ return ITheme::TYPE_THEME;
+ }
+
+ public function getTitle(): string {
+ return $this->l->t('Light theme');
+ }
+
+ public function getEnableLabel(): string {
+ return $this->l->t('Enable the default light theme');
+ }
+
+ public function getDescription(): string {
+ return $this->l->t('The default light appearance.');
+ }
+
+ public function getMediaQuery(): string {
+ return '(prefers-color-scheme: light)';
+ }
+}