-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy paththemes.html
591 lines (525 loc) · 20.5 KB
/
themes.html
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="description" content="Materialize is a modern responsive CSS framework based on Material Design by Google." />
<title>Themes - Materialize</title>
<!-- Favicons-->
<link
rel="apple-touch-icon-precomposed"
href="images/favicon/apple-touch-icon-152x152.png"
/>
<meta name="msapplication-TileColor" content="#FFFFFF" />
<meta
name="msapplication-TileImage"
content="images/favicon/mstile-144x144.png"
/>
<link rel="icon" href="images/favicon/favicon-32x32.png" sizes="32x32" />
<!-- Android 5 Chrome Color-->
<!--<meta name="theme-color" content="#EE6E73" />-->
<style>
@import url("https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900,900i");
</style>
<!-- CSS-->
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined"
rel="stylesheet"
/>
<script>
const theme = localStorage.getItem("theme");
if (theme) document.documentElement.setAttribute("theme", theme);
</script>
<script type="module" crossorigin src="/assets/main-7444f380.js"></script>
<link rel="stylesheet" href="/assets/main-0dd28cd6.css">
</head>
<body>
<header>
<div class="search-results card"></div>
<!-- Top Nav -->
<div class="navbar-fixed">
<nav class="nav navbar">
<div class="nav-wrapper primary">
<a class="brand-logo">Themes</a>
<a class="sidenav-trigger" href="#" data-target="nav-mobile"><i class="material-icons">menu</i></a>
<ul class="right">
<li>
<a href="" onclick="paletteSelectorModal.showModal(); return false;">
<i class="material-icons">palette</i>
</a>
</li>
<li>
<a id="theme-switch" href="#">
<i class="material-icons">dark_mode</i>
</a>
</li>
<li>
<a class="ext-link" href="https://github.com/materializecss/materialize" target="_blank" rel="noopener" title="Check out our GitHub">
<img src="images/github.svg" alt="GitHub logo" style="height: 20px" />
</a>
</li>
<li>
<a class="ext-link" href="https://opencollective.com/materialize" target="_blank" rel="noopener" title="Support us via OpenCollective">
<img src="images/opencollective.svg" alt="Open Collective logo" />
</a>
</li>
</ul>
</div>
</nav>
</div>
<!-- Sidenav -->
<ul class="sidenav sidenav-fixed" id="nav-mobile">
<li class="logo">
<a class="brand-logo" id="logo-container" href="/">
<img id="front-page-logo" src="images/materialize.svg" alt="Materialize Web Logo"/>
Materialize
</a>
</li>
<li class="search">
<div class="search-wrapper">
<input class="search-docs" id="search" type="search" placeholder="Search" autocomplete="off" autofocus /><i class="material-icons">search</i>
</div>
</li>
<li class="">
<a href="about.html">
<span class="material-icons">info</span>
About</a>
</li> <li class="">
<a href="getting-started.html">
<span class="material-icons">apps</span>
Getting started</a>
</li> <li>
<ul class="collapsible collapsible-accordion">
<li class="active">
<a class="collapsible-header waves-effect">
<span class="material-icons">palette</span>
Styles
</a>
<div class="collapsible-body">
<ul>
<li class="">
<a href="color.html">
Color</a>
</li><li class="">
<a href="grid.html">
Grid</a>
</li><li class="">
<a href="helpers.html">
Helpers</a>
</li><li class="">
<a href="media-css.html">
Media Styles</a>
</li><li class="">
<a href="pulse.html">
Pulse</a>
</li><li class="">
<a href="sass.html">
Sass</a>
</li><li class="">
<a href="shadow.html">
Shadow</a>
</li><li class="">
<a href="table.html">
Table</a>
</li><li class="">
<a href="css-transitions.html">
Transitions</a>
</li><li class="">
<a href="typography.html">
Typography</a>
</li><li class="active">
<a href="themes.html">
Themes</a>
</li><li class="">
<a href="waves.html">
Waves</a>
</li>
</ul>
</div>
</li>
</ul>
</li> <li>
<ul class="collapsible collapsible-accordion">
<li class="">
<a class="collapsible-header waves-effect">
<span class="material-icons">add_circle</span>
Components
</a>
<div class="collapsible-body">
<ul>
<li class="">
<a href="badges.html">
Badges</a>
</li><li class="">
<a href="buttons.html">
Buttons</a>
</li><li class="">
<a href="breadcrumbs.html">
Breadcrumbs</a>
</li><li class="">
<a href="cards.html">
Cards</a>
</li><li class="">
<a href="collections.html">
Collections</a>
</li><li class="">
<a href="floating-action-button.html">
Floating Action Button</a>
</li><li class="">
<a href="footer.html">
Footer</a>
</li><li class="">
<a href="icons.html">
Icons</a>
</li><li class="">
<a href="navbar.html">
Navbar</a>
</li><li class="">
<a href="pagination.html">
Pagination</a>
</li><li class="">
<a href="preloader.html">
Preloader</a>
</li><li class="">
<a href="auto-init.html">
Auto Init</a>
</li><li class="">
<a href="carousel.html">
Carousel</a>
</li><li class="">
<a href="collapsible.html">
Collapsible</a>
</li><li class="">
<a href="dropdown.html">
Dropdown</a>
</li><li class="">
<a href="feature-discovery.html">
Feature Discovery</a>
</li><li class="">
<a href="media.html">
Media</a>
</li><li class="">
<a href="modals.html">
Modals</a>
</li><li class="">
<a href="parallax.html">
Parallax</a>
</li><li class="">
<a href="pushpin.html">
Pushpin</a>
</li><li class="">
<a href="scrollspy.html">
Scrollspy</a>
</li><li class="">
<a href="sidenav.html">
Sidenav</a>
</li><li class="">
<a href="tabs.html">
Tabs</a>
</li><li class="">
<a href="toasts.html">
Toasts</a>
</li><li class="">
<a href="tooltips.html">
Tooltips</a>
</li><li class="">
<a href="datepicker.html">
Date Picker</a>
</li><li class="">
<a href="timepicker.html">
Time Picker</a>
</li>
</ul>
</div>
</li>
</ul>
</li> <li>
<ul class="collapsible collapsible-accordion">
<li class="">
<a class="collapsible-header waves-effect">
<span class="material-icons">text_fields</span>
Forms
</a>
<div class="collapsible-body">
<ul>
<li class="">
<a href="autocomplete.html">
Autocomplete</a>
</li><li class="">
<a href="checkboxes.html">
Checkboxes</a>
</li><li class="">
<a href="chips.html">
Chips</a>
</li><li class="">
<a href="radio-buttons.html">
Radio Buttons</a>
</li><li class="">
<a href="range.html">
Range</a>
</li><li class="">
<a href="select.html">
Select</a>
</li><li class="">
<a href="switches.html">
Switches</a>
</li><li class="">
<a href="text-inputs.html">
Text Inputs</a>
</li>
</ul>
</div>
</li>
</ul>
</li> <li class="">
<a href="mobile.html">
<span class="material-icons">mobile_friendly</span>
Mobile</a>
</li>
<li class="version">
<a class="dropdown-trigger" href="#" data-target="version-dropdown">
<!-- svg -->
v2.2.1<svg class="caret" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M7 10l5 5 5-5z"></path>
<path d="M0 0h24v24H0z" fill="none"></path>
</svg>
</a>
<ul class="dropdown-content" id="version-dropdown">
<li><a href="/">Latest</a></li>
<li><a href="/version/v2.1.1/">v2.1.1</a></li>
<li><a>2.1.0</a></li>
<li><a>2.0.4</a></li>
<li><a>2.0.3-alpha</a></li>
</ul>
</li>
</ul>
</header>
<dialog id="paletteSelectorModal" class="modal">
<div class="modal-header">
<h4>Color Scheme</h4>
</div>
<div class="modal-content">
<div class="color-row">
<input type="color" id="color-picker" value="#0000ff">
<label for="color-picker">Primary Color</label>
</div>
<button id="downloadCss" type="button" class="btn tonal">Download css style</button>
</div>
<div class="modal-footer">
<button type="button" class="btn text waves-effect" onclick="paletteSelectorModal.close()">Close</button>
</div>
</dialog>
<main>
<section class="section primary-container m-2" style="border-radius: 24px" id="index-banner">
<div class="container row py-5">
<div class="col s12 m8 offset-m1 xl7 offset-xl1 center-on-small-only">
<h1 class="header" style="font-size: 4.2rem; color: var(--md-sys-color-primary)">Themes</h1>
<h4 class="light" style="line-height: 1.25; color: var(--md-sys-color-primary)">Materialize is a modern responsive CSS framework based on Material Design by Google.</h4>
</div>
</div>
</section>
<div class="container">
<div class="row">
<div class="s12 m8 offset-m1 xl7 offset-xl1">
<div class="section">
<p>
Materialize supports themeing. Most commonly there is a light and a dark mode theme. You also can customize your own individual theme too. Here is an example for an
easy theme-switch.
</p>
</div>
<div class="section scrollspy" id="reading-theme">
<h2>Reading Theme Setting</h2>
<p>
Make sure you include this short code snippet before the
<code></head></code> tag.
</p>
<p>
It has to be loaded as soon as possible (therefore put it as first script) to avoid flickering of the page. It is also recommended to put this code directly into
into the HTML code to load faster (no additional requests).
</p>
<pre><code class="language-javascript">
<xmp>
<script>
function getTheme() {
const isDarkModeEnabledViaCss = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const currentTheme = localStorage.getItem('theme');
const isDark = currentTheme ? currentTheme === 'dark' : isDarkModeEnabledViaCss;
return isDark;
}
function setTheme(enableDark) {
document.documentElement.setAttribute('theme', enableDark ? 'dark' : 'light');
localStorage.setItem('theme', enableDark ? 'dark' : 'light');
}
const currentState = getTheme();
setTheme(currentState);
</script>
</xmp>
</code></pre>
<p>This Script loads the users settings from the local storage and sets a parameter which can be then used to set variables in the CSS.</p>
</div>
<div class="section scrollspy" id="changing-theme">
<h2>Changing Theme Setting</h2>
<p>The Theme can be switched instantly via click of a button.</p>
<p>
The following example binds a Theme-Switching Function to an HTML-Element, which has a class of `btn-switch-theme`. To test this, you can click on the moon or the
sun icon at this page in the top-right corenr to see it in action!
</p>
<pre><code class="language-javascript"> // Change Theme Setting with a Switch
function getTheme() {
const isDarkModeEnabledViaCss = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const currentTheme = localStorage.getItem('theme');
const isDark = currentTheme ? currentTheme === 'dark' : isDarkModeEnabledViaCss;
return isDark;
}
function setTheme(enableDark) {
document.documentElement.setAttribute('theme', enableDark ? 'dark' : 'light');
localStorage.setItem('theme', enableDark ? 'dark' : 'light');
}
function updateDarkModeButtonState(isCurrentlyDarkModeEnabled) {
const element = document.querySelector('.btn-switch-theme');
element.classList.remove('is-dark');
if (isCurrentlyDarkModeEnabled) element.classList.add('is-dark');
element.querySelector('span').innerText = isCurrentlyDarkModeEnabled ? 'light_mode' : 'dark_mode';
element.title = 'Switch to ' + (isCurrentlyDarkModeEnabled ? 'light' : 'dark') + ' mode';
}
// Init Theme and Button
const darkModeButton = document.querySelector('.btn-switch-theme');
darkModeButton.addEventListener('click', (e) => {
e.preventDefault();
const nextState = !getTheme(); // toggle
setTheme(nextState);
updateDarkModeButtonState(nextState);
});
const currentState = getTheme();
setTheme(currentState);
updateDarkModeButtonState(currentState);
</code></pre>
</div>
<div class="section scrollspy" id="creating-theme">
<h2>Creating a Theme</h2>
<p>
To create or overwrite a theme, you have to set the variables of the Theme. This variables can be defined in a seperate CSS-File and included before the
Materialize-CSS File inside of the
<code class="language-html"><strong>head</strong></code>
tags.
</p>
<p class="error-text">Deprecated in 2.1.0! Use the Material M3 Variables instead to create a custom Theme!</p>
<p>Here is an example of the standard Dark-Theme:</p>
<pre><code class="language-css">
:root[theme='dark'] {
--background-color: #121212;
--surface-color: #242424;
--font-color-main: rgba(255, 255, 255, 0.87);
--font-color-medium: rgba(255, 255, 255, 0.60);
--font-color-disabled: rgba(255, 255, 255, 0.38);
--font-on-primary-color-main: rgba(0, 0, 0, 0.87);
--font-on-primary-color-dark-main: rgba(255, 255, 255, 0.87);
--font-on-primary-color-dark-medium: rgba(255, 255, 255, 0.60);
--font-on-primary-color-medium: rgba(0, 0, 0, 0.56);
--font-on-primary-color-disabled: rgba(0, 0, 0, 0.38);
--hover-color: rgba(255, 255, 255, 0.04);
--focus-color: rgba(255, 255, 255, 0.12);
--focus-color-solid: #424242;
--background-color-disabled: rgba(255, 255, 255, 0.12);
--background-color-level-4dp: rgba(255, 255, 255, 0.09);
--background-color-level-16dp-solid: #262626;
--background-color-card: var(--surface-color);
--background-color-slight-emphasis: rgba(255, 255, 255, 0.05);
--slider-track-color: rgba(255, 255, 255, 0.26);
--switch-thumb-off-color: #bababa;
--primary-color: #B39DDB;
--primary-color-dark: #9575CD;
--primary-color-numeric: 179, 157, 219;
--primary-color-raised-hover-solid: #C2ACEA;
--primary-color-raised-focus-solid: #DBC5FF;
--secondary-color: #CDDC39;
--secondary-color-hover-solid: #DCEB48;
--secondary-color-focus-solid: #F5FF61;
--secondary-container-color: #B39DDB;
--font-on-secondary-container-color: rgba(255, 255, 255, 0.87);
--md_sys_color_on-surface: 230, 225, 229;
}
</code></pre>
</div>
</div>
<div class="hide-on-small-only m3 xl3">
<div class="toc-wrapper">
<div style="height: 1px">
<ul class="section table-of-contents">
<li><a href="#reading-theme">Reading Theme</a></li>
<li><a href="#changing-theme">Changing Theme</a></li>
<li><a href="#creating-theme">Creating Theme</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="page-footer">
<div class="container">
<div class="row">
<div class="s12 m10 offset-m1">
<div class="row" style="gap: 2rem">
<div class="s12 m6 l4">
<h5>Help Materialize Grow</h5>
<p>
We hope you have enjoyed using <a href="https://materializeweb.com">Materialize</a> and if you feel like it has helped you out and want to support the team you can
help us by opening issues or contributing on GitHub.
</p>
<a tabindex="0" class="btn tonal btn-small waves-effect waves-light" target="_blank" href="https://github.com/materializecss/materialize">Contribute</a>
</div>
<div class="s12 m6 l4">
<h5>Join the Discussion</h5>
<p>
We have a Gitter chat room set up where you can talk directly with us. Come in and discuss new features, future goals, general problems or questions, or anything else
you can think of.
</p>
<a tabindex="0" class="btn tonal btn-small waves-effect waves-light" href="https://gitter.im/materializecss/materialize" target="_blank">Chat</a>
</div>
<div class="s12 m6 l4" style="overflow: hidden">
<h5>Star us</h5>
<div>
<a href="https://github.com/materializecss/materialize" target="_blank">
<img style="width: 42%" alt="GitHub Repo stars" src="https://img.shields.io/github/stars/materializecss/materialize" />
</a>
</div>
<!-- Ad Placements -->
<div style="width: 100%; background-color: #f883">
<div style="height: 90px; width: 100%">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9412332535613378" crossorigin="anonymous"></script>
<ins
class="adsbygoogle"
style="display: block"
data-ad-format="fluid"
data-ad-layout-key="-fb+5w+4e-db+86"
data-ad-client="ca-pub-9412332535613378"
data-ad-slot="4127762940"
></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</div>
<div class="footer-copyright">
© 2014-
<noscript>2018</noscript>
<script>
document.write(new Date().getFullYear());
</script>
Materialize, All rights reserved.<a class="right" target="_blank" href="https://github.com/materializecss/materialize/blob/main/LICENSE">MIT License</a>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>