PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Plugin / ThemeStyles.php
matomo / app / core / Plugin Last commit date
Dimension 6 years ago API.php 6 years ago AggregatedMetric.php 6 years ago ArchivedMetric.php 6 years ago Archiver.php 6 years ago Categories.php 6 years ago ComponentFactory.php 6 years ago ComputedMetric.php 6 years ago ConsoleCommand.php 6 years ago Controller.php 6 years ago ControllerAdmin.php 6 years ago Dependency.php 6 years ago LogTablesProvider.php 6 years ago Manager.php 6 years ago Menu.php 6 years ago MetadataLoader.php 6 years ago Metric.php 6 years ago PluginException.php 6 years ago ProcessedMetric.php 6 years ago ReleaseChannels.php 6 years ago Report.php 6 years ago ReportsProvider.php 6 years ago RequestProcessors.php 6 years ago Segment.php 6 years ago SettingsProvider.php 6 years ago Tasks.php 6 years ago ThemeStyles.php 6 years ago ViewDataTable.php 6 years ago Visualization.php 6 years ago WidgetsProvider.php 6 years ago
ThemeStyles.php
237 lines
1 <?php
2 /**
3 * Piwik - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9
10 namespace Piwik\Plugin;
11
12
13 use Piwik\Piwik;
14
15 class ThemeStyles
16 {
17 // to maintain BC w/ old names that were defined in LESS
18 private static $propertyNamesToLessVariableNames = [
19 'fontFamilyBase' => 'theme-fontFamily-base',
20 'colorBrand' => 'theme-color-brand',
21 'colorBrandContrast' => 'theme-color-brand-contrast',
22 'colorText' => 'theme-color-text',
23 'colorTextLight' => 'theme-color-text-light',
24 'colorTextLighter' => 'theme-color-text-lighter',
25 'colorTextContrast' => 'theme-color-text-contrast',
26 'colorLink' => 'theme-color-link',
27 'colorBaseSeries' => 'theme-color-base-series',
28 'colorHeadlineAlternative' => 'theme-color-headline-alternative',
29 'colorHeaderBackground' => 'theme-color-header-background',
30 'colorHeaderText' => 'theme-color-header-text',
31 'colorMenuContrastText' => 'theme-color-menu-contrast-text',
32 'colorMenuContrastTextSelected' => 'theme-color-menu-contrast-textSelected',
33 'colorMenuContrastTextActive' => 'theme-color-menu-contrast-textActive',
34 'colorMenuContrastBackground' => 'theme-color-menu-contrast-background',
35 'colorWidgetExportedBackgroundBase' => 'theme-color-widget-exported-background-base',
36 'colorWidgetTitleText' => 'theme-color-widget-title-text',
37 'colorWidgetTitleBackground' => 'theme-color-widget-title-background',
38 'colorBackgroundBase' => 'theme-color-background-base',
39 'colorBackgroundTinyContrast' => 'theme-color-background-tinyContrast',
40 'colorBackgroundLowContrast' => 'theme-color-background-lowContrast',
41 'colorBackgroundContrast' => 'theme-color-background-contrast',
42 'colorBackgroundHighContrast' => 'theme-color-background-highContrast',
43 'colorBorder' => 'theme-color-border',
44 'colorCode' => 'theme-color-code',
45 'colorCodeBackground' => 'theme-color-code-background',
46 'colorWidgetBackground' => 'theme-color-widget-background',
47 'colorWidgetBorder' => 'theme-color-widget-border',
48 ];
49
50 /**
51 * @var string
52 */
53 public $fontFamilyBase = '-apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Cantarell, \'Helvetica Neue\', sans-serif';
54
55 /**
56 * @var string
57 */
58 public $colorBrand = '#43a047';
59
60 /**
61 * @var string
62 */
63 public $colorBrandContrast = '#fff';
64
65 /**
66 * @var string
67 */
68 public $colorText = '#212121';
69
70 /**
71 * @var string
72 */
73 public $colorTextLight = '#444';
74
75 /**
76 * @var string
77 */
78 public $colorTextLighter = '#666666';
79
80 /**
81 * @var string
82 */
83 public $colorTextContrast = '#37474f';
84
85 /**
86 * @var string
87 */
88 public $colorLink = '#1976D2';
89
90 /**
91 * @var string
92 */
93 public $colorBaseSeries = '#ee3024';
94
95 /**
96 * @var string
97 */
98 public $colorHeadlineAlternative = '#4E4E4E';
99
100 /**
101 * @var string
102 */
103 public $colorHeaderBackground = '#3450A3';
104
105 /**
106 * @var string
107 */
108 public $colorHeaderText = '#fff';
109
110 /**
111 * @var string
112 */
113 public $colorMenuContrastText;
114
115 /**
116 * @var string
117 */
118 public $colorMenuContrastTextSelected;
119
120 /**
121 * @var string
122 */
123 public $colorMenuContrastTextActive = '#3450A3';
124
125 /**
126 * @var string
127 */
128 public $colorMenuContrastBackground;
129
130 /**
131 * @var string
132 */
133 public $colorWidgetExportedBackgroundBase;
134
135 /**
136 * @var string
137 */
138 public $colorWidgetTitleText;
139
140 /**
141 * @var string
142 */
143 public $colorWidgetTitleBackground;
144
145 /**
146 * @var string
147 */
148 public $colorBackgroundBase = '#eff0f1';
149
150 /**
151 * @var string
152 */
153 public $colorBackgroundTinyContrast = '#f2f2f2';
154
155 /**
156 * @var string
157 */
158 public $colorBackgroundLowContrast = '#d9d9d9';
159
160 /**
161 * @var string
162 */
163 public $colorBackgroundContrast = '#fff';
164
165 /**
166 * @var string
167 */
168 public $colorBackgroundHighContrast = '#202020';
169
170 /**
171 * @var string
172 */
173 public $colorBorder = '#cccccc';
174
175 /**
176 * @var string
177 */
178 public $colorCode = '#f3f3f3';
179
180 /**
181 * @var string
182 */
183 public $colorCodeBackground = '#4d4d4d';
184
185 /**
186 * @var string
187 */
188 public $colorWidgetBackground;
189
190 /**
191 * @var string
192 */
193 public $colorWidgetBorder;
194
195 public function __construct()
196 {
197 $this->colorMenuContrastText = $this->colorText;
198 $this->colorMenuContrastTextSelected = $this->colorMenuContrastText;
199 $this->colorMenuContrastBackground = $this->colorBackgroundContrast;
200 $this->colorWidgetExportedBackgroundBase = $this->colorBackgroundContrast;
201 $this->colorWidgetTitleText = $this->colorText;
202 $this->colorWidgetTitleBackground = $this->colorBackgroundContrast;
203 $this->colorWidgetBackground = $this->colorBackgroundContrast;
204 $this->colorWidgetBorder = $this->colorBackgroundTinyContrast;
205 }
206
207 /**
208 * @return ThemeStyles
209 */
210 public static function get()
211 {
212 $result = new self();
213
214 /**
215 * @ignore
216 */
217 Piwik::postEvent('Theme.configureThemeVariables', [$result]);
218
219 return $result;
220 }
221
222 public function toLessCode()
223 {
224 $result = '';
225 foreach (get_object_vars($this) as $name => $value) {
226 $varName = isset(self::$propertyNamesToLessVariableNames[$name]) ? self::$propertyNamesToLessVariableNames[$name] : $this->getGenericThemeVarName($name);
227 $result .= "@$varName = $value;\n";
228 }
229 return $result;
230 }
231
232 private function getGenericThemeVarName($propertyName)
233 {
234 return 'theme-' . $propertyName;
235 }
236 }
237