mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-21 15:43:51 +00:00
Use bootstraps bultin functionality to switch theme
This commit is contained in:
parent
c19c1695dc
commit
b716a165c8
34
index.html
34
index.html
|
@ -1,18 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<title>FreqUI</title>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<title>FreqUI</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body data-bs-theme="dark">
|
||||
<noscript>
|
||||
<strong>We're sorry but FreqUI doesn't work properly without JavaScript enabled. Please enable it to
|
||||
continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but FreqUI doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useColorMode } from 'bootstrap-vue-next';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
const mode = useColorMode();
|
||||
|
||||
const activeTheme = ref('');
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
|
@ -18,17 +21,14 @@ const setTheme = (themeName: string) => {
|
|||
}
|
||||
if (themeName.toLowerCase() === 'bootstrap' || themeName.toLowerCase() === 'bootstrap_dark') {
|
||||
// const styles = document.getElementsByTagName('style');
|
||||
document.documentElement.setAttribute(
|
||||
'data-theme',
|
||||
themeName.toLowerCase() === 'bootstrap' ? 'light' : 'dark',
|
||||
);
|
||||
if (activeTheme.value) {
|
||||
// Only transition if simple mode is active
|
||||
document.documentElement.classList.add('ft-theme-transition');
|
||||
document.body.classList.add('ft-theme-transition');
|
||||
window.setTimeout(() => {
|
||||
document.documentElement.classList.remove('ft-theme-transition');
|
||||
document.body.classList.remove('ft-theme-transition');
|
||||
}, 1000);
|
||||
}
|
||||
mode.value = themeName.toLowerCase() === 'bootstrap' ? 'light' : 'dark';
|
||||
}
|
||||
// Save the theme as localstorage
|
||||
settingsStore.currentTheme = themeName;
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
// $body-bg: rgb(42, 42, 49);
|
||||
$font-size-base: 0.9rem;
|
||||
$primary: #0089a1;
|
||||
|
||||
$body-bg-dark: #121212;
|
||||
$body-color-dark: #dedede;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
transform: none !important;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
[data-bs-theme="dark"] {
|
||||
$bg-dark: rgb(18, 18, 18);
|
||||
|
||||
$bg-darker: darken($bg-dark, 5%);
|
||||
|
@ -227,11 +227,14 @@
|
|||
background-color: unset !important;
|
||||
}
|
||||
|
||||
html.ft-theme-transition,
|
||||
html.ft-theme-transition *,
|
||||
html.ft-theme-transition *:before,
|
||||
html.ft-theme-transition *:after {
|
||||
transition: background 750ms ease-in-out,
|
||||
border-color 750ms ease-in-out;
|
||||
body.ft-theme-transition,
|
||||
body.ft-theme-transition *,
|
||||
body.ft-theme-transition *:before,
|
||||
body.ft-theme-transition *:after {
|
||||
transition:
|
||||
background 750ms ease-in-out,
|
||||
border-color 750ms ease-in-out,
|
||||
background-color 750ms ease-in-out,
|
||||
;
|
||||
transition-delay: 0 !important;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user