| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @copyright Copyright (c) 2022 Joas Schilling <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @author Joas Schilling <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @author John Molakvoæ <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @license GNU AGPL version 3 or any later version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * This program is free software: you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * it under the terms of the GNU Affero General Public License as | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * published by the Free Software Foundation, either version 3 of the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * License, or (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * GNU Affero General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * along with this program. If not, see <http://www.gnu.org/licenses/>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | namespace OCA\Theming\Themes; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use OCA\Theming\ImageManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use OCA\Theming\ThemingDefaults; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use OCA\Theming\Util; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use OCA\Theming\ITheme; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use OCP\IConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use OCP\IL10N; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | use OCP\IURLGenerator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | class DefaultTheme implements ITheme { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	public Util $util; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	public ThemingDefaults $themingDefaults; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	public IURLGenerator $urlGenerator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	public ImageManager $imageManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	public IConfig $config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	public IL10N $l; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	public string $primaryColor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	public function __construct(Util $util, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 								ThemingDefaults $themingDefaults, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 								IURLGenerator $urlGenerator, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 								ImageManager $imageManager, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 								IConfig $config, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 								IL10N $l) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$this->util = $util; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 		$this->themingDefaults = $themingDefaults; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		$this->urlGenerator = $urlGenerator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		$this->imageManager = $imageManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$this->config = $config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		$this->l = $l; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		$this->primaryColor = $this->themingDefaults->getColorPrimary(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	public function getId(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		return 'default'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	public function getType(): int { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 		return ITheme::TYPE_THEME; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	public function getTitle(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 		return $this->l->t('System default theme'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	public function getEnableLabel(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 		return $this->l->t('Enable the system default'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	public function getDescription(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 		return $this->l->t('Using the default system appearance.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  | 	public function getMediaQuery(): string { | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  | 		return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	public function getCSSVariables(): array { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 		$colorMainText = '#222222'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		$colorMainBackground = '#ffffff'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 		$colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 		$colorBoxShadow = $this->util->darken($colorMainBackground, 70); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		$colorBoxShadowRGB = join(',', $this->util->hexToRGB($colorBoxShadow)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		$colorPrimaryLight = $this->util->mix($this->primaryColor, $colorMainBackground, -80); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		$colorPrimaryElement = $this->util->elementColor($this->primaryColor); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		$colorPrimaryElementLight = $this->util->mix($colorPrimaryElement, $colorMainBackground, -80); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 		$hasCustomLogoHeader = $this->imageManager->hasImage('logo') ||  $this->imageManager->hasImage('logoheader'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 		$hasCustomPrimaryColour = !empty($this->config->getAppValue('theming', 'color')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 		$variables = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 			'--color-main-background' => $colorMainBackground, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 			'--color-main-background-rgb' => $colorMainBackgroundRGB, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 			'--color-main-background-translucent' => 'rgba(var(--color-main-background-rgb), .97)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 			'--color-main-background-blur' => 'rgba(var(--color-main-background-rgb), .8)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 			'--filter-background-blur' => 'blur(25px)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 			// to use like this: background-image: linear-gradient(0, var('--gradient-main-background)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 			'--gradient-main-background' => 'var(--color-main-background) 0%, var(--color-main-background-translucent) 85%, transparent 100%', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 			// used for different active/hover/focus/disabled states | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 			'--color-background-hover' => $this->util->darken($colorMainBackground, 4), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 			'--color-background-dark' => $this->util->darken($colorMainBackground, 7), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 			'--color-background-darker' => $this->util->darken($colorMainBackground, 14), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 			'--color-placeholder-light' => $this->util->darken($colorMainBackground, 10), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 			'--color-placeholder-dark' => $this->util->darken($colorMainBackground, 20), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 			// primary related colours | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 			'--color-primary' => $this->primaryColor, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 			'--color-primary-text' => $this->util->invertTextColor($this->primaryColor) ? '#000000' : '#ffffff', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 			'--color-primary-hover' => $this->util->mix($this->primaryColor, $colorMainBackground, 60), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 			'--color-primary-light' => $colorPrimaryLight, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 			'--color-primary-light-text' => $this->primaryColor, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 			'--color-primary-light-hover' => $this->util->mix($colorPrimaryLight, $colorMainText, 90), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 			'--color-primary-text-dark' => $this->util->darken($this->util->invertTextColor($this->primaryColor) ? '#000000' : '#ffffff', 7), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 			// used for buttons, inputs... | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 			'--color-primary-element' => $colorPrimaryElement, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 			'--color-primary-element-text' => $this->util->invertTextColor($colorPrimaryElement) ? '#000000' : '#ffffff', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 			'--color-primary-element-hover' => $this->util->mix($colorPrimaryElement, $colorMainBackground, 60), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 			'--color-primary-element-light' => $colorPrimaryElementLight, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 			'--color-primary-element-light-text' => $colorPrimaryElement, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 			'--color-primary-element-light-hover' => $this->util->mix($colorPrimaryElementLight, $colorMainText, 90), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 			'--color-primary-element-text-dark' => $this->util->darken($this->util->invertTextColor($colorPrimaryElement) ? '#000000' : '#ffffff', 7), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 			// to use like this: background-image: var(--gradient-primary-background); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 			'--gradient-primary-background' => 'linear-gradient(40deg, var(--color-primary) 0%, var(--color-primary-hover) 100%)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 			// max contrast for WCAG compliance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 			'--color-main-text' => $colorMainText, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 			'--color-text-maxcontrast' => $this->util->lighten($colorMainText, 33), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 			'--color-text-light' => $colorMainText, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 			'--color-text-lighter' => $this->util->lighten($colorMainText, 33), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 			// info/warning/success feedback colours | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 			'--color-error' => '#e9322d', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 			'--color-error-rgb' => join(',', $this->util->hexToRGB('#e9322d')), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 			'--color-error-hover' => $this->util->mix('#e9322d', $colorMainBackground, 60), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 			'--color-warning' => '#eca700', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 			'--color-warning-rgb' => join(',', $this->util->hexToRGB('#eca700')), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 			'--color-warning-hover' => $this->util->mix('#eca700', $colorMainBackground, 60), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 			'--color-success' => '#46ba61', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 			'--color-success-rgb' => join(',', $this->util->hexToRGB('#46ba61')), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 			'--color-success-hover' => $this->util->mix('#46ba61', $colorMainBackground, 60), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 			// used for the icon loading animation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 			'--color-loading-light' => '#cccccc', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 			'--color-loading-dark' => '#444444', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 			'--color-box-shadow-rgb' => $colorBoxShadowRGB, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 			'--color-box-shadow' => "rgba(var(--color-box-shadow-rgb), 0.5)", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 			'--color-border' => $this->util->darken($colorMainBackground, 7), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 			'--color-border-dark' => $this->util->darken($colorMainBackground, 14), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 			'--font-face' => "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, Ubuntu, 'Helvetica Neue', Arial, sans-serif, 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 			'--default-font-size' => '15px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 			// TODO: support "(prefers-reduced-motion)" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 			'--animation-quick' => '100ms', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 			'--animation-slow' => '300ms', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 			// Default variables -------------------------------------------- | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 			'--border-radius' => '3px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 			'--border-radius-large' => '10px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 			// pill-style button, value is large so big buttons also have correct roundness | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 			'--border-radius-pill' => '100px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 			'--default-line-height' => '24px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 			// various structure data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 			'--header-height' => '50px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 			'--navigation-width' => '300px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 			'--sidebar-min-width' => '300px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 			'--sidebar-max-width' => '500px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 			'--list-min-width' => '200px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			'--list-max-width' => '300px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 			'--header-menu-item-height' => '44px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 			'--header-menu-profile-item-height' => '66px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			// mobile. Keep in sync with core/js/js.js | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 			'--breakpoint-mobile' => '1024px', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 			// invert filter if primary is too bright | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 			// to be used for legacy reasons only. Use inline | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 			// svg with proper css variable instead or material | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 			// design icons. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 			// ⚠️ Using 'no' as a value to make sure we specify an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 			// invalid one with no fallback. 'unset' could here fallback to some | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 			// other theme with media queries | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 			'--primary-invert-if-bright' => $this->util->invertTextColor($this->primaryColor) ? 'invert(100%)' : 'no', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 			'--background-invert-if-dark' => 'no', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 			'--background-invert-if-bright' => 'invert(100%)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 			'--image-main-background' => "url('" . $this->urlGenerator->imagePath('core', 'app-background.jpg') . "')", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		$backgroundDeleted = $this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		// If primary as background has been request or if we have a custom primary colour | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 		// let's not define the background image | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 		if ($backgroundDeleted || $hasCustomPrimaryColour) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			$variables["--image-background-plain"] = 'true'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 		// Register image variables only if custom-defined | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 		foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 			if ($this->imageManager->hasImage($image)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 				$imageUrl = $this->imageManager->getImageUrl($image); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 				if ($image === 'background') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 					// If background deleted is set, ignoring variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 					if ($backgroundDeleted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 						continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 					$variables['--image-background-size'] = 'cover'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 					$variables['--image-main-background'] = "url('" . $imageUrl . "')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 				$variables["--image-$image"] = "url('" . $imageUrl . "')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 		if ($hasCustomLogoHeader) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 			$variables["--image-logoheader-custom"] = 'true'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 		return $variables; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 	public function getCustomCss(): string { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 		return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 238 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 239 |  |  |  |