Implement dark mode
This commit is contained in:
parent
0a387c1087
commit
84960fdd44
@ -7,4 +7,5 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
require('@tailwindcss/typography')
|
require('@tailwindcss/typography')
|
||||||
],
|
],
|
||||||
|
darkMode: 'selector',
|
||||||
}
|
}
|
||||||
|
@ -2,30 +2,21 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
body {
|
|
||||||
width: 800px;
|
|
||||||
@apply mx-auto text-slate-900;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
@apply font-bold mb-2 text-2xl;
|
@apply font-bold mb-2 text-2xl;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
h3 {
|
||||||
@apply flex flex-col gap-y-3;
|
@apply font-bold mb-2 text-xl;
|
||||||
}
|
|
||||||
|
|
||||||
input[type="file"] {
|
|
||||||
@apply border rounded-md w-full;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="password"],
|
input[type="password"],
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
@apply border h-8 rounded-md;
|
@apply bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800 h-8 rounded-md;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@apply border h-32 rounded-md;
|
@apply bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800 h-32 rounded-md;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-area {
|
.btn-area {
|
||||||
@ -33,9 +24,41 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@apply bg-slate-200 border my-2 px-3 py-2 rounded-md w-full hover:bg-slate-100;
|
@apply bg-slate-200 dark:bg-slate-800 hover:bg-slate-100 dark:hover:bg-slate-900 border border-slate-200 dark:border-slate-800 my-2 px-3 py-2 rounded-md w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
@apply bg-slate-800 border my-2 px-3 py-2 rounded-md text-slate-50 w-full hover:bg-slate-700;
|
@apply bg-slate-800 dark:bg-slate-200 hover:bg-slate-700 dark:hover:bg-slate-300 my-2 px-3 py-2 rounded-md text-slate-50 dark:text-slate-950 w-full;
|
||||||
|
}
|
||||||
|
|
||||||
|
.EasyMDEContainer .CodeMirror {
|
||||||
|
@apply bg-slate-50 dark:bg-slate-950 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-slate-100
|
||||||
|
}
|
||||||
|
|
||||||
|
.EasyMDEContainer .cm-s-easymde .CodeMirror-cursor {
|
||||||
|
@apply border-slate-900 dark:border-slate-100
|
||||||
|
}
|
||||||
|
|
||||||
|
.EasyMDEContainer .editor-toolbar > * {
|
||||||
|
@apply text-slate-900 dark:text-slate-100
|
||||||
|
}
|
||||||
|
|
||||||
|
.EasyMDEContainer .editor-toolbar > .active, .editor-toolbar > button:hover, .editor-preview pre, .cm-s-easymde .cm-comment {
|
||||||
|
@apply bg-slate-100 dark:bg-slate-900
|
||||||
|
}
|
||||||
|
|
||||||
|
.EasyMDEContainer .CodeMirror-fullscreen {
|
||||||
|
@apply bg-slate-50 dark:bg-slate-950
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar {
|
||||||
|
@apply border border-slate-200
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen {
|
||||||
|
@apply bg-slate-50 dark:bg-slate-950
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview {
|
||||||
|
@apply bg-slate-50 dark:bg-slate-950
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,26 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Orient Editor</title>
|
<title>Orient Editor</title>
|
||||||
|
|
||||||
<link href="/web/static/css/style.css" rel="stylesheet">
|
<link href="/web/static/css/style.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="flex flex-col justify-between min-h-screen bg-slate-50">
|
<body style="width: 800px;"
|
||||||
|
class="bg-slate-50 dark:bg-slate-950 flex flex-col justify-between min-h-screen mx-auto text-slate-900 dark:text-slate-100">
|
||||||
<header class="my-8">
|
<header class="my-8">
|
||||||
<h1 class="font-bold text-4xl text-center">Orient Editor</h1>
|
<h1 class="font-bold text-4xl text-center">Orient Editor</h1>
|
||||||
|
|
||||||
|
<div class="ml-4">
|
||||||
|
<label class="cursor-pointer flex items-center relative" for="theme-toggle">
|
||||||
|
<div class="bg-slate-200 dark:bg-slate-800 block h-6 w-12 rounded-full"></div>
|
||||||
|
<div
|
||||||
|
class="absolute bg-slate-800 dark:bg-slate-50 dot left-1 top-1 h-4 w-4 rounded-full transform transition">
|
||||||
|
</div>
|
||||||
|
<span class="ml-2">Dunkel</span>
|
||||||
|
</label>
|
||||||
|
<input type="checkbox" id="theme-toggle" class="sr-only">
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="mx-4">
|
<main class="mx-4">
|
||||||
@ -20,18 +33,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="text-center text-gray-500 dark:text-gray-400 my-8">
|
<footer class="text-center text-gray-500 my-8">
|
||||||
<p>
|
<p>
|
||||||
© 2024 Jason Streifling. Alle Rechte vorbehalten.
|
© 2024 Jason Streifling. Alle Rechte vorbehalten.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
v0.8.3 - <strong>Hinweis:</strong> Diese Software befindet sich noch in der Entwicklung und kann Fehler
|
v0.9.0 - <strong>Hinweis:</strong> Diese Software befindet sich noch in der Entwicklung und kann Fehler
|
||||||
enthalten.
|
enthalten.
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="https://unpkg.com/htmx.org@2.0.2"></script>
|
<script src="https://unpkg.com/htmx.org@2.0.2"></script>
|
||||||
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
|
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const toggleSwitch = document.getElementById('theme-toggle');
|
||||||
|
const dot = document.querySelector('.dot');
|
||||||
|
|
||||||
|
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||||
|
document.documentElement.classList.add('dark')
|
||||||
|
toggleSwitch.checked = true;
|
||||||
|
dot.classList.add('translate-x-6');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('dark')
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSwitch.addEventListener('change', () => {
|
||||||
|
if (toggleSwitch.checked) {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
localStorage.theme = 'dark';
|
||||||
|
dot.classList.add('translate-x-6');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
localStorage.theme = 'light';
|
||||||
|
dot.classList.remove('translate-x-6');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user