feat: use style replacements for background and theme color

This also adds the default theme color for the DokuWiki template as the
green from the existing links.
This commit is contained in:
Michael Große 2018-02-01 11:38:09 +01:00
parent fb1f9089ad
commit 6f8582363c
No known key found for this signature in database
GPG Key ID: 7E31028FBFEACC79
4 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,3 @@
{
"display": "standalone",
"background_color": "#ffffff"
"display": "standalone"
}

View File

@ -27,6 +27,18 @@ class Manifest {
$manifest['start_url'] = DOKU_REL;
}
$styleUtil = new \dokuwiki\StyleUtils();
$styleIni = $styleUtil->cssStyleini($conf['template']);
$replacements = $styleIni['replacements'];
if (empty($manifest['background_color'])) {
$manifest['background_color'] = $replacements['__background__'];
}
if (empty($manifest['theme_color'])) {
$manifest['theme_color'] = !empty($replacements['__theme_color__']) ? $replacements['__theme_color__'] : $replacements['__background_alt__'];
}
if (empty($manifest['icons'])) {
$manifest['icons'] = [];
$look = [

View File

@ -10,3 +10,4 @@ $lang['__site_width__'] = 'The width of the full site (can be any length unit
$lang['__sidebar_width__'] = 'The width of the sidebar, if any (can be any length unit: %, px, em, ...)';
$lang['__tablet_width__'] = 'Below screensizes of this width, the site switches to tablet mode';
$lang['__phone_width__'] = 'Below screensizes of this width, the site switches to phone mode';
$lang['__theme_color__'] = 'Theme color of the web app';

View File

@ -85,3 +85,5 @@ __sidebar_width__ = "16em" ; @ini_sidebar_width
; cut off points for mobile devices
__tablet_width__ = "800px" ; @ini_tablet_width
__phone_width__ = "480px" ; @ini_phone_width
__theme_color__ = "#008800" ; @_ini_theme_color: theme_color of the web app