[mobile] adapt skeleton for dark theme
This commit is contained in:
parent
07af4cd5fd
commit
bd89e046e7
10
apps/common/mobile/utils/htmlutils.js
Normal file
10
apps/common/mobile/utils/htmlutils.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme"));
|
||||||
|
if ( !obj ) {
|
||||||
|
if ( window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) {
|
||||||
|
obj = {id: 'theme-dark', type: 'dark'};
|
||||||
|
localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.classList.add(`theme-type-${obj.type}`);
|
|
@ -32,17 +32,11 @@
|
||||||
<!-- built styles file will be auto injected -->
|
<!-- built styles file will be auto injected -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %>
|
||||||
<script>
|
<script>
|
||||||
let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme"));
|
<%= htmlWebpackPlugin.options.skeleton.htmlscript %>
|
||||||
if ( !obj ) {
|
|
||||||
if ( window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) {
|
|
||||||
obj = {id: 'theme-dark', type: 'dark'};
|
|
||||||
localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.classList.add(`theme-type-${obj.type}`);
|
|
||||||
</script>
|
</script>
|
||||||
|
<% } %>
|
||||||
<section class="skl-container">
|
<section class="skl-container">
|
||||||
<div class="skl-navbar skl-navbar--word"></div>
|
<div class="skl-navbar skl-navbar--word"></div>
|
||||||
<div class="skl-lines">
|
<div class="skl-lines">
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
<!-- built styles file will be auto injected -->
|
<!-- built styles file will be auto injected -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %>
|
||||||
|
<script>
|
||||||
|
<%= htmlWebpackPlugin.options.skeleton.htmlscript %>
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
<section class="skl-container">
|
<section class="skl-container">
|
||||||
<div class="skl-navbar skl-navbar--slide"></div>
|
<div class="skl-navbar skl-navbar--slide"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
<!-- built styles file will be auto injected -->
|
<!-- built styles file will be auto injected -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %>
|
||||||
|
<script>
|
||||||
|
<%= htmlWebpackPlugin.options.skeleton.htmlscript %>
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
<section class="skl-container ">
|
<section class="skl-container ">
|
||||||
<div class="skl-navbar skl-navbar--cell"></div>
|
<div class="skl-navbar skl-navbar--cell"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -211,6 +211,7 @@ module.exports = {
|
||||||
} : false,
|
} : false,
|
||||||
skeleton: {
|
skeleton: {
|
||||||
stylesheet: env === 'development' ? undefined : fs.readFileSync(`../../apps/common/mobile/resources/css/skeleton.css`),
|
stylesheet: env === 'development' ? undefined : fs.readFileSync(`../../apps/common/mobile/resources/css/skeleton.css`),
|
||||||
|
htmlscript: fs.readFileSync(`../../apps/common/mobile/utils/htmlutils.js`),
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
env: {
|
env: {
|
||||||
|
|
Loading…
Reference in a new issue