feat: make default style dark

This commit is contained in:
Spectralitree 2021-12-11 11:58:50 +01:00
parent fbf2d3b719
commit 43c151aaba
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pk-webs | home</title> <title>pk-webs | home</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-night.min.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-night.min.css" />
<link rel="stylesheet" href="style.css" />
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -4,10 +4,11 @@
import Navigation from "./lib/Navigation.svelte"; import Navigation from "./lib/Navigation.svelte";
// theme cdns (I might make some myself too)
let light = "https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"; let light = "https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css";
let dark = "https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-night.min.css"; let dark = "https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-night.min.css";
let styleSrc = light; let styleSrc = dark;
onMount(() => { onMount(() => {
if (localStorage.getItem("pk-style")) setStyle(localStorage.getItem("pk-style").toLowerCase()); if (localStorage.getItem("pk-style")) setStyle(localStorage.getItem("pk-style").toLowerCase());
@ -29,6 +30,8 @@
break; break;
default: styleSrc = light; default: styleSrc = light;
localStorage.setItem("pk-style", "light"); localStorage.setItem("pk-style", "light");
default: styleSrc = dark;
localStorage.setItem("pk-style", "dark");
}; };
}; };
</script> </script>