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>
|
<!DOCTYPE html>
|
||||||
<html lang="en" data-theme="dark">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
<head>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<link rel="icon" href="/favicon.ico">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<title>FreqUI</title>
|
<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>
|
</html>
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useSettingsStore } from '@/stores/settings';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
|
import { useColorMode } from 'bootstrap-vue-next';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const mode = useColorMode();
|
||||||
|
|
||||||
const activeTheme = ref('');
|
const activeTheme = ref('');
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
@ -18,17 +21,14 @@ const setTheme = (themeName: string) => {
|
||||||
}
|
}
|
||||||
if (themeName.toLowerCase() === 'bootstrap' || themeName.toLowerCase() === 'bootstrap_dark') {
|
if (themeName.toLowerCase() === 'bootstrap' || themeName.toLowerCase() === 'bootstrap_dark') {
|
||||||
// const styles = document.getElementsByTagName('style');
|
// const styles = document.getElementsByTagName('style');
|
||||||
document.documentElement.setAttribute(
|
|
||||||
'data-theme',
|
|
||||||
themeName.toLowerCase() === 'bootstrap' ? 'light' : 'dark',
|
|
||||||
);
|
|
||||||
if (activeTheme.value) {
|
if (activeTheme.value) {
|
||||||
// Only transition if simple mode is active
|
// Only transition if simple mode is active
|
||||||
document.documentElement.classList.add('ft-theme-transition');
|
document.body.classList.add('ft-theme-transition');
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
document.documentElement.classList.remove('ft-theme-transition');
|
document.body.classList.remove('ft-theme-transition');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
mode.value = themeName.toLowerCase() === 'bootstrap' ? 'light' : 'dark';
|
||||||
}
|
}
|
||||||
// Save the theme as localstorage
|
// Save the theme as localstorage
|
||||||
settingsStore.currentTheme = themeName;
|
settingsStore.currentTheme = themeName;
|
||||||
|
|
|
@ -2,3 +2,6 @@
|
||||||
// $body-bg: rgb(42, 42, 49);
|
// $body-bg: rgb(42, 42, 49);
|
||||||
$font-size-base: 0.9rem;
|
$font-size-base: 0.9rem;
|
||||||
$primary: #0089a1;
|
$primary: #0089a1;
|
||||||
|
|
||||||
|
$body-bg-dark: #121212;
|
||||||
|
$body-color-dark: #dedede;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
transform: none !important;
|
transform: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme="dark"] {
|
[data-bs-theme="dark"] {
|
||||||
$bg-dark: rgb(18, 18, 18);
|
$bg-dark: rgb(18, 18, 18);
|
||||||
|
|
||||||
$bg-darker: darken($bg-dark, 5%);
|
$bg-darker: darken($bg-dark, 5%);
|
||||||
|
@ -227,11 +227,14 @@
|
||||||
background-color: unset !important;
|
background-color: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.ft-theme-transition,
|
body.ft-theme-transition,
|
||||||
html.ft-theme-transition *,
|
body.ft-theme-transition *,
|
||||||
html.ft-theme-transition *:before,
|
body.ft-theme-transition *:before,
|
||||||
html.ft-theme-transition *:after {
|
body.ft-theme-transition *:after {
|
||||||
transition: background 750ms ease-in-out,
|
transition:
|
||||||
border-color 750ms ease-in-out;
|
background 750ms ease-in-out,
|
||||||
|
border-color 750ms ease-in-out,
|
||||||
|
background-color 750ms ease-in-out,
|
||||||
|
;
|
||||||
transition-delay: 0 !important;
|
transition-delay: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user