Skip to content

Commit c67a1c0

Browse files
committed
fix: make meta colors off by default and add an option to enable it
1 parent 4bd004c commit c67a1c0

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

docs/app/pages/UiElements/Scrollbar/Scrollbar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<page-container centered :title="$t('pages.scrollbar.title')">
55
<div class="page-container-section">
66
<p>Scrollbars show the track on how much a content has been reviewed. This is an standard on every single device out there.</p>
7-
<p>To enable the Material scrollbar styles, just add the <code>md-scrollbar</code> class to the scrollable component that you want. If you want this effect in the whole page, you can put the class in the <code>body</code> tag.</p>
8-
<p>The scrollbars <strong>only</strong> works on <code>body</code> tag and on Vue Material components, like <code>md-content</code>. Due to CSS limitations, the style will be applied only on Webkit/Blink browsers (Chrome, Safari and Opera):</p>
7+
<p>To enable the Material scrollbar styles, just add the <code>md-scrollbar</code> class to the scrollable component that you want. If you want this effect in the whole page, you can put the class in the <code>html</code> tag.</p>
8+
<p>The scrollbars <strong>only</strong> works on <code>html</code> tag and on Vue Material components, like <code>md-content</code>. Due to CSS limitations, the style will be applied only on Webkit/Blink browsers (Chrome, Safari and Opera):</p>
99
</div>
1010

1111
<div class="page-container-section">

docs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!doctype html>
22

3-
<html lang="en-us">
3+
<html lang="en-us" class="md-scrollbar">
44
<head>
55
<meta charset="utf-8">
66
<meta http-equiv="cleartype" content="on">
@@ -29,7 +29,7 @@
2929
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
3030
</head>
3131

32-
<body class="md-scrollbar">
32+
<body>
3333
<div id="docs"></div>
3434
</body>
3535
</html>

src/core/MdTheme.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default new Vue({
99
prefix: 'md-theme-',
1010
theme: 'default',
1111
enabled: true,
12-
themeTarget: document.body
12+
metaColors: false,
13+
themeTarget: document.documentElement
1314
}),
1415
computed: {
1516
fullThemeName () {
@@ -24,10 +25,10 @@ export default new Vue({
2425

2526
if (enabled) {
2627
themeTarget.classList.add(fullThemeName)
27-
this.setHtmlMetaColors(fullThemeName)
28+
this.metaColors && this.setHtmlMetaColors(fullThemeName)
2829
} else {
2930
themeTarget.classList.remove(fullThemeName)
30-
this.setHtmlMetaColors()
31+
this.metaColors && this.setHtmlMetaColors()
3132
}
3233
}
3334
},
@@ -38,7 +39,17 @@ export default new Vue({
3839

3940
themeTarget.classList.remove(getThemeName(oldTheme))
4041
themeTarget.classList.add(newTheme)
41-
this.setHtmlMetaColors(newTheme)
42+
43+
if (this.metaColors) {
44+
this.setHtmlMetaColors(newTheme)
45+
}
46+
},
47+
metaColors (meta) {
48+
if (meta) {
49+
this.setHtmlMetaColors(this.fullThemeName)
50+
} else {
51+
this.setHtmlMetaColors()
52+
}
4253
}
4354
},
4455
methods: {
@@ -101,7 +112,7 @@ export default new Vue({
101112
}
102113
},
103114
created () {
104-
if (this.enabled) {
115+
if (this.enabled && this.metaColors) {
105116
window.addEventListener('load', () => {
106117
this.setHtmlMetaColors(this.fullThemeName)
107118
})

src/material.js

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ const material = new MdReactive({
1818
})
1919

2020
Object.defineProperties(material.theming, {
21+
metaColors: {
22+
get: () => MdTheme.metaColors,
23+
set (metaColors) {
24+
MdTheme.metaColors = metaColors
25+
}
26+
},
2127
theme: {
2228
get: () => MdTheme.theme,
2329
set (theme) {

src/theme/variables.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $md-color-levels: (
8484
icon: #fff,
8585
icon-disabled: rgba(#fff, .5),
8686
divider: rgba(#fff, .12),
87-
scrollbar: #303030,
87+
scrollbar: #212121,
8888
scrollbar-background: #616161
8989
)
9090
);

0 commit comments

Comments
 (0)