Basic dark theme handling

This commit is contained in:
Simounet
2020-11-08 15:04:29 +01:00
parent 7f49e5cd1b
commit a562f6b943
16 changed files with 165 additions and 11 deletions

View File

@ -51,6 +51,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
new TwigFunction('count_tags', [$this, 'countTags']),
new TwigFunction('display_stats', [$this, 'displayStats']),
new TwigFunction('asset_file_exists', [$this, 'assetFileExists']),
new TwigFunction('theme_class', [$this, 'themeClass']),
];
}
@ -171,6 +172,11 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
return file_exists(realpath($this->rootDir . '/../web/' . $name));
}
public function themeClass()
{
return isset($_COOKIE['theme']) && 'dark' === $_COOKIE['theme'] ? 'dark-theme' : '';
}
public function getName()
{
return 'wallabag_extension';