File modules/cms/ui/action/index/IndexThemestyleAction.class.php
Last commit: Mon Nov 4 23:19:15 2024 +0100 Jan Dankert UI: Re-enabling support for dark and light color themes.
1 <?php 2 namespace cms\ui\action\index; 3 use cms\action\Method; 4 use cms\base\Configuration as C; 5 use cms\ui\action\IndexAction; 6 use cms\ui\themes\ThemeStyle; 7 use util\ArrayUtils; 8 use util\text\Converter; 9 10 class IndexThemestyleAction extends IndexAction implements Method { 11 12 public function view() { 13 14 //$this->lastModified( Config::filemtime($themeLessFile)); 15 16 $styleName = $this->request->getText('style'); 17 18 $this->setTemplateVar('style',$this->getThemeProperties( $styleName) ); 19 } 20 21 22 public function post() { 23 } 24 25 26 /** 27 * Gets the theme CSS. 28 * 29 * @param $styleId string name of style 30 * @return array The theme properties 31 */ 32 protected function getThemeProperties($styleId ) 33 { 34 $styleConfig = C::subset( ['style',$styleId] ); 35 36 $schemesConfig = []; 37 foreach ( $styleConfig->subset('schemes')->subsets() as $scheme=>$config ) { 38 39 $schemeConfig = $config->merge( $styleConfig->subset('defaults') ); 40 $themeStyle = new ThemeStyle( $schemeConfig->getConfig() ); 41 42 $schemesConfig[ $scheme ] = ArrayUtils::mapKeys( function($prop) { 43 return Converter::camelToUnderscore($prop, '-'); 44 },$themeStyle->getProperties()); 45 46 } 47 48 return $schemesConfig; 49 } 50 51 }
Downloadmodules/cms/ui/action/index/IndexThemestyleAction.class.php
History Mon, 4 Nov 2024 23:19:15 +0100 Jan Dankert UI: Re-enabling support for dark and light color themes. Sun, 13 Oct 2024 15:00:13 +0200 Jan Dankert Refactoring CSS: Using native CSS variables for theme colors. Sun, 6 Feb 2022 21:56:52 +0100 dankert New CssOutput which outputs the CSS in a cleaner way. Mon, 29 Nov 2021 01:22:40 +0100 Jan Dankert New: Themes may contain multiple color schemes (for now only "dark" and "light"), modern browsers are selecting the right scheme. Sat, 27 Mar 2021 10:40:59 +0100 Jan Dankert Only generate the actual necessary theme style. Wed, 10 Feb 2021 22:04:26 +0100 Jan Dankert Provide the theme configuration through a class. Wed, 18 Nov 2020 20:23:57 +0100 Jan Dankert Cleaning up the UI actions. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.