diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-04-20 10:55:41 +0300 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-04-21 10:31:07 +0300 |
commit | 493b20605f9819a03a23cf0da456f89634307152 (patch) | |
tree | cdacf96788fd9212051a19c9a9bf55e9c31f512c /apps/theming/lib/Controller | |
parent | 9ea72b10104ceb482be33b4626c3603a788a687f (diff) |
Font fixes and design update for theme picker
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming/lib/Controller')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 1cd269f9bff..ff30e27f721 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -55,6 +55,7 @@ use OCP\IL10N; use OCP\IRequest; use OCP\ITempManager; use OCP\IURLGenerator; +use ScssPhp\ScssPhp\Compiler; /** * Class ThemingController @@ -309,13 +310,14 @@ class ThemingController extends Controller { * * @return FileDisplayResponse|NotFoundResponse */ - public function getThemeVariables(string $themeId, bool $plain = false) { + public function getThemeStylesheet(string $themeId, bool $plain = false, bool $withCustomCss = false) { $themes = $this->themesService->getThemes(); if (!in_array($themeId, array_keys($themes))) { return new NotFoundResponse(); } $theme = $themes[$themeId]; + $customCss = $theme->getCustomCss(); // Generate variables $variables = ''; @@ -325,10 +327,12 @@ class ThemingController extends Controller { // If plain is set, the browser decides of the css priority if ($plain) { - $css = ":root { $variables }"; + $css = ":root { $variables } " . $customCss; } else { // If not set, we'll rely on the body class - $css = "body[data-theme-$themeId] { $variables }"; + $compiler = new Compiler(); + $compiledCss = $compiler->compileString("body[data-theme-$themeId] { $variables $customCss }"); + $css = $compiledCss->getCss();; } try { |