Repository navigation
Expand file tree
/
Copy pathGoogleTheme.php
More file actions
154 lines (127 loc) · 6.5 KB
/
Copy pathGoogleTheme.php
File metadata and controls
154 lines (127 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\GoogleTheme;
use Piwik\Plugin;
class GoogleTheme extends Plugin
{
public function registerEvents()
{
return [
'Template.afterEventsReport' => 'renderOpenmostCommunicationAfterEvents',
'Widget.filterWidgets' => 'addOpenmostCommunicationWidgets',
'Template.beforeContent' => 'renderOpenmostCommunication',
'Theme.configureThemeVariables' => 'configureThemeVariables',
];
}
public function configureThemeVariables(Plugin\ThemeStyles $vars)
{
// Brand (Google blue) — shared across light & dark
$brand = '#1a73e8';
$brandLight = '#4285f4';
$brandLighter = '#8ab4f8';
$brandDark = '#1557b0';
// Light surfaces (Google Material light scale)
$lightSurfaceBase = '#f8f9fa';
$lightSurfaceRaised = '#ffffff';
$lightSurfaceOverlay = '#f1f3f4';
$lightSurfaceGround = '#e8eaed';
// Dark surfaces (Google Material dark scale)
$darkSurfaceBase = '#202124';
$darkSurfaceRaised = '#292a2d';
$darkSurfaceOverlay = '#3c4043';
$darkSurfaceGround = '#17181b';
// Text scales
$lightTextPrimary = '#202124';
$lightTextSecondary = '#3c4043';
$lightTextTertiary = '#5f6368';
$lightTextDisabled = '#9aa0a6';
$darkTextPrimary = '#e8eaed';
$darkTextSecondary = 'rgba(232, 234, 237, 0.87)';
$darkTextTertiary = 'rgba(232, 234, 237, 0.65)';
$darkTextDisabled = 'rgba(232, 234, 237, 0.40)';
// Borders
$lightBorder = '#dadce0';
$lightBorderStrong = '#bdc1c6';
$darkBorder = '#3c4043';
$darkBorderStrong = '#5f6368';
// Font
$vars->fontFamilyBase = '"Google Sans", Arial, Helvetica, sans-serif';
// Brand
$vars->colorBrand = [$brand, $brandLighter];
$vars->colorBrandContrast = ['#ffffff', '#202124'];
$vars->colorSuccess = ['#1e8e3e', '#81c995'];
// Focus
$vars->colorFocusRing = [$brand, $brandLighter];
$vars->colorFocusRingAlternative = [$brand, $brandLighter];
// Text
$vars->colorTextHighContrast = [$lightTextPrimary, $darkTextPrimary];
$vars->colorText = [$lightTextPrimary, $darkTextSecondary];
$vars->colorTextContrast = [$lightTextSecondary, $darkTextPrimary];
$vars->colorTextLight = [$lightTextTertiary, $darkTextTertiary];
$vars->colorTextLighter = [$lightTextTertiary, $darkTextTertiary];
$vars->colorTextOnDisabled = [$lightTextDisabled, $darkTextDisabled];
$vars->colorTextDisabled = [$lightTextDisabled, $darkTextDisabled];
$vars->colorTextPlaceholder = [$lightTextDisabled, $darkTextDisabled];
$vars->colorTextInvert = ['#ffffff', '#202124'];
$vars->colorTextInvertContrast = ['#ffffff', '#000000'];
$vars->colorTextInvertLight = ['#dadce0', '#5f6368'];
// Links
$vars->colorLink = ['#1976d2', $brandLighter];
// Charts (kept distinctive in both modes)
$vars->colorBaseSeries = '#ee3024';
// Headlines
$vars->colorHeadlineAlternative = [$lightTextSecondary, $darkTextTertiary];
// Header (top bar)
$vars->colorHeaderBackground = [$lightSurfaceRaised, $darkSurfaceRaised];
$vars->colorHeaderText = [$lightTextTertiary, $darkTextPrimary];
// Menus
$vars->colorMenuContrastText = [$lightTextPrimary, $darkTextTertiary];
$vars->colorMenuContrastTextSelected = [$brand, $brandLighter];
$vars->colorMenuContrastTextActive = [$brandDark, $darkTextPrimary];
$vars->colorMenuContrastBackground = [$lightSurfaceRaised, $darkSurfaceRaised];
$vars->colorMenuContrastBackgroundHover = [$lightSurfaceOverlay, $darkSurfaceOverlay];
// Widgets
$vars->colorWidgetBackground = [$lightSurfaceRaised, $darkSurfaceRaised];
$vars->colorWidgetBorder = [$lightBorder, $darkBorder];
$vars->colorWidgetExportedBackgroundBase = [$lightSurfaceOverlay, $darkSurfaceRaised];
$vars->colorWidgetTitleBackground = [$lightSurfaceRaised, $darkSurfaceRaised];
$vars->colorWidgetTitleText = [$lightTextPrimary, $darkTextPrimary];
// Backgrounds
$vars->colorBackgroundBase = [$lightSurfaceBase, $darkSurfaceBase];
$vars->colorBackgroundTinyContrast = [$lightSurfaceOverlay, $darkSurfaceOverlay];
$vars->colorBackgroundLowContrast = [$lightSurfaceGround, $darkSurfaceRaised];
$vars->colorBackgroundContrast = [$lightSurfaceRaised, $darkSurfaceRaised];
$vars->colorBackgroundHighContrast = ['#202020', $darkSurfaceGround];
$vars->colorBackgroundDisabled = [$lightSurfaceGround, '#303339'];
// Borders
$vars->colorBorder = [$lightBorder, $darkBorder];
$vars->colorBorderAlternative = [$lightBorder, $darkBorder];
$vars->colorBorderLight = [$lightBorderStrong, $darkBorderStrong];
// Code blocks
$vars->colorCode = ['#f3f3f3', $darkTextSecondary];
$vars->colorCodeBackground = ['#4d4d4d', $darkSurfaceOverlay];
// Box shadow
$vars->colorBoxShadow = ['rgba(60, 64, 67, 0.15)', 'rgba(0, 0, 0, 0.4)'];
$vars->shadowOverlay = ['0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15)', '0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.3)'];
// Illustration filter (invert white pngs/svgs to look right on dark)
$vars->filterOnIllustration = ['none', 'brightness(89%) invert(100%) hue-rotate(180deg)'];
}
public function renderOpenmostCommunication(&$out, $layout, $module = '', $action = '')
{
OpenmostCommunication::beforeContent($out, (string) $layout, (string) $module, (string) $action, $this->getPluginName());
}
public function addOpenmostCommunicationWidgets($list)
{
OpenmostCommunication::filterWidgets($list, $this->getPluginName());
}
public function renderOpenmostCommunicationAfterEvents(&$out, $dataTable = null)
{
OpenmostCommunication::afterEventsReport($out, $this->getPluginName());
}
}