updated theming and fixed warnings
This commit is contained in:
25
frontend/src/components/ThemeSwitcher.astro
Normal file
25
frontend/src/components/ThemeSwitcher.astro
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
const { defaultTheme } = Astro.props;
|
||||
---
|
||||
|
||||
<select id="user-theme-switcher" class="bg-surface0/50 text-text border border-surface1 rounded px-2 py-1 text-xs focus:outline-none focus:border-mauve transition-colors cursor-pointer">
|
||||
<option value="mocha">Mocha</option>
|
||||
<option value="macchiato">Macchiato</option>
|
||||
<option value="frappe">Frappe</option>
|
||||
<option value="latte">Latte</option>
|
||||
<option value="scaled-and-icy">Scaled and Icy</option>
|
||||
</select>
|
||||
|
||||
<script is:inline define:vars={{ defaultTheme }}>
|
||||
const switcher = document.getElementById('user-theme-switcher');
|
||||
if (switcher) {
|
||||
const savedTheme = localStorage.getItem('user-theme') || defaultTheme;
|
||||
switcher.value = savedTheme;
|
||||
|
||||
switcher.addEventListener('change', (e) => {
|
||||
const newTheme = e.target.value;
|
||||
localStorage.setItem('user-theme', newTheme);
|
||||
document.documentElement.className = newTheme;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import '../styles/global.css';
|
||||
import ThemeSwitcher from '../components/ThemeSwitcher.astro';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
@@ -45,7 +46,7 @@ try {
|
||||
</head>
|
||||
<body class="bg-base text-text selection:bg-surface2 selection:text-text">
|
||||
<!-- Dynamic Mesh Gradient Background -->
|
||||
<div class="fixed inset-0 z-[-1] overflow-hidden bg-base">
|
||||
<div class="fixed inset-0 z-[-1] overflow-hidden bg-base text-text">
|
||||
<div class="absolute top-[-10%] left-[-10%] w-[60%] h-[50%] rounded-full bg-mauve/15 blur-[120px] opacity-70 animate-pulse" style="animation-duration: 10s;"></div>
|
||||
<div class="absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] rounded-full bg-blue/15 blur-[120px] opacity-60 animate-pulse" style="animation-duration: 15s;"></div>
|
||||
<div class="absolute top-[30%] right-[10%] w-[40%] h-[40%] rounded-full bg-teal/10 blur-[100px] opacity-50 animate-pulse" style="animation-duration: 12s;"></div>
|
||||
@@ -62,13 +63,7 @@ try {
|
||||
<div class="flex gap-3 md:gap-4 items-center text-sm md:text-base w-full md:w-auto justify-center md:justify-end">
|
||||
<a href="/" class="text-subtext0 hover:text-text transition-colors">Home</a>
|
||||
<a href="/admin" class="text-subtext0 hover:text-mauve transition-colors">Admin</a>
|
||||
<select id="user-theme-switcher" class="bg-surface0/50 text-text border border-surface1 rounded px-2 py-1 text-xs focus:outline-none focus:border-mauve transition-colors cursor-pointer">
|
||||
<option value="mocha">Mocha</option>
|
||||
<option value="macchiato">Macchiato</option>
|
||||
<option value="frappe">Frappe</option>
|
||||
<option value="latte">Latte</option>
|
||||
<option value="scaled-and-icy">Scaled and Icy</option>
|
||||
</select>
|
||||
<ThemeSwitcher defaultTheme={siteConfig.theme} />
|
||||
</div>
|
||||
</header>
|
||||
</nav>
|
||||
@@ -83,21 +78,5 @@ try {
|
||||
© {new Date().getFullYear()} {siteConfig.title}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script is:inline define:vars={{ defaultTheme: siteConfig.theme }}>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const switcher = document.getElementById('user-theme-switcher');
|
||||
if (switcher) {
|
||||
const savedTheme = localStorage.getItem('user-theme') || defaultTheme;
|
||||
switcher.value = savedTheme;
|
||||
|
||||
switcher.addEventListener('change', (e) => {
|
||||
const newTheme = e.target.value;
|
||||
localStorage.setItem('user-theme', newTheme);
|
||||
document.documentElement.className = newTheme;
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@ import AdminLayout from '../../layouts/AdminLayout.astro';
|
||||
---
|
||||
|
||||
<AdminLayout title="Write Post">
|
||||
<p slot="header-subtitle" id="post-status" class="text-subtext1 mt-2 text-sm md:text-base">Create/Edit post.</p>
|
||||
<p slot="header-subtitle" id="post-status" class="mt-2 text-sm md:text-base" style="color: var(--text) !important;">Create/Edit post.</p>
|
||||
|
||||
<div slot="header-actions" class="flex gap-4 w-full">
|
||||
<button id="delete-btn" class="hidden text-red hover:bg-red/10 px-6 py-3 rounded-lg transition-colors font-bold border border-red/20 w-full md:w-auto">
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
/*
|
||||
* NARLBLOG PROFESSIONAL THEME ENGINE
|
||||
* All UI components are automatically linked to these tokens.
|
||||
*/
|
||||
|
||||
@theme {
|
||||
--color-crust: var(--crust);
|
||||
--color-mantle: var(--mantle);
|
||||
@@ -65,11 +70,12 @@
|
||||
--flamingo: #eebebe; --rosewater: #f2d5cf;
|
||||
}
|
||||
|
||||
/* Highly optimized light mode colors */
|
||||
.latte {
|
||||
--crust: #e6e9ef; --mantle: #dce0e8; --base: #eff1f5;
|
||||
--surface0: #ccd0da; --surface1: #bcc0cc; --surface2: #acb0be;
|
||||
--overlay0: #9ca0b0; --overlay1: #8c8fa1; --overlay2: #7c7f93;
|
||||
--text: #4c4f69; --subtext0: #5c5f77; --subtext1: #6c6f85;
|
||||
--text: #1e1e2e; --subtext0: #4c4f69; --subtext1: #5c5f77;
|
||||
--blue: #1e66f5; --lavender: #7287fd; --sapphire: #209fb5;
|
||||
--sky: #04a5e5; --teal: #179299; --green: #40a02b;
|
||||
--yellow: #df8e1d; --peach: #fe640b; --maroon: #e64553;
|
||||
@@ -96,57 +102,18 @@ body {
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Dynamic CodeMirror Theme */
|
||||
.cm-s-narlblog.CodeMirror {
|
||||
background: var(--crust) !important;
|
||||
color: var(--text) !important;
|
||||
border: 1px solid var(--surface1);
|
||||
}
|
||||
.cm-s-narlblog .cm-header { color: var(--mauve) !important; font-weight: bold; }
|
||||
.cm-s-narlblog .cm-string { color: var(--green) !important; }
|
||||
.cm-s-narlblog .cm-link { color: var(--blue) !important; text-decoration: underline; }
|
||||
.cm-s-narlblog .cm-url { color: var(--sky) !important; }
|
||||
.cm-s-narlblog .cm-comment { color: var(--subtext0) !important; font-style: italic; }
|
||||
.cm-s-narlblog .cm-quote { color: var(--peach) !important; }
|
||||
.cm-s-narlblog .CodeMirror-cursor { border-left-color: var(--text) !important; }
|
||||
.cm-s-narlblog.cm-fat-cursor .CodeMirror-cursor { background: var(--text) !important; }
|
||||
.cm-s-narlblog .CodeMirror-selected { background: var(--surface2) !important; }
|
||||
.cm-s-narlblog .CodeMirror-line::selection, .cm-s-narlblog .CodeMirror-line > span::selection, .cm-s-narlblog .CodeMirror-line > span > span::selection { background: var(--surface2); }
|
||||
.cm-s-narlblog .CodeMirror-line::-moz-selection, .cm-s-narlblog .CodeMirror-line > span::-moz-selection, .cm-s-narlblog .CodeMirror-line > span > span::-moz-selection { background: var(--surface2); }
|
||||
|
||||
/* Dynamic Highlight.js Theme */
|
||||
.hljs { color: var(--text) !important; background: transparent !important; }
|
||||
.hljs-comment, .hljs-quote { color: var(--subtext0) !important; font-style: italic; }
|
||||
.hljs-keyword, .hljs-selector-tag, .hljs-subst { color: var(--mauve) !important; font-weight: bold; }
|
||||
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable, .hljs-tag .hljs-attr { color: var(--peach) !important; }
|
||||
.hljs-string, .hljs-doctag { color: var(--green) !important; }
|
||||
.hljs-title, .hljs-section, .hljs-selector-id { color: var(--blue) !important; font-weight: bold; }
|
||||
.hljs-type, .hljs-class .hljs-title { color: var(--yellow) !important; font-weight: bold; }
|
||||
.hljs-tag, .hljs-name, .hljs-attribute { color: var(--blue) !important; font-weight: normal; }
|
||||
.hljs-regexp, .hljs-link { color: var(--sky) !important; }
|
||||
.hljs-symbol, .hljs-bullet { color: var(--pink) !important; }
|
||||
.hljs-built_in, .hljs-builtin-name { color: var(--red) !important; }
|
||||
.hljs-meta { color: var(--overlay1) !important; font-weight: bold; }
|
||||
.hljs-deletion { background: var(--maroon); color: var(--crust); }
|
||||
.hljs-addition { background: var(--green); color: var(--crust); }
|
||||
.hljs-emphasis { font-style: italic; }
|
||||
.hljs-strong { font-weight: bold; }
|
||||
|
||||
/* Typography styles for Markdown */
|
||||
/* Professional Typography */
|
||||
.prose { color: var(--text) !important; }
|
||||
.prose h1 { @apply text-3xl md:text-4xl font-bold mb-4 md:mb-6 text-mauve; color: var(--mauve) !important; }
|
||||
.prose h2 { @apply text-2xl md:text-3xl font-semibold mb-3 md:mb-4 mt-6 md:mt-8 text-lavender; color: var(--lavender) !important; }
|
||||
.prose h3 { @apply text-xl md:text-2xl font-medium mb-2 md:mb-3 mt-4 md:mt-6 text-blue; color: var(--blue) !important; }
|
||||
.prose h1 { @apply text-3xl md:text-4xl font-bold mb-4 md:mb-6; color: var(--mauve) !important; }
|
||||
.prose h2 { @apply text-2xl md:text-3xl font-semibold mb-3 md:mb-4 mt-6 md:mt-8; color: var(--lavender) !important; }
|
||||
.prose h3 { @apply text-xl md:text-2xl font-medium mb-2 md:mb-3 mt-4 md:mt-6; color: var(--blue) !important; }
|
||||
.prose p { @apply mb-3 md:mb-4 leading-relaxed text-sm md:text-base; color: var(--text) !important; }
|
||||
.prose a { @apply text-blue hover:text-sky underline underline-offset-4 decoration-2 decoration-blue/30 hover:decoration-sky transition-colors; color: var(--blue) !important; }
|
||||
.prose ul { @apply list-disc list-inside mb-3 md:mb-4 text-sm md:text-base; color: var(--text) !important; }
|
||||
.prose ol { @apply list-decimal list-inside mb-3 md:mb-4 text-sm md:text-base; color: var(--text) !important; }
|
||||
.prose blockquote { @apply border-l-4 border-surface2 pl-4 italic text-subtext0 my-4 md:my-6 text-sm md:text-base; color: var(--subtext0) !important; }
|
||||
.prose pre { @apply bg-crust p-3 md:p-4 rounded-xl overflow-x-auto border border-white/5 my-4 md:my-6 text-xs md:text-sm; background-color: var(--crust) !important; }
|
||||
.prose code { @apply bg-surface0 px-1.5 py-0.5 rounded text-xs md:text-sm font-mono text-peach; color: var(--peach) !important; }
|
||||
.prose blockquote { @apply border-l-4 border-surface2 pl-4 italic my-4 md:my-6; color: var(--subtext0) !important; }
|
||||
.prose pre { @apply p-3 md:p-4 rounded-xl overflow-x-auto border border-white/5 my-4 md:my-6 text-xs md:text-sm; background-color: var(--crust) !important; }
|
||||
.prose code { @apply bg-surface0 px-1.5 py-0.5 rounded text-xs md:text-sm font-mono; color: var(--peach) !important; }
|
||||
.prose pre code { background-color: transparent !important; padding: 0 !important; border-radius: 0 !important; color: inherit !important; }
|
||||
.prose img { @apply max-w-full h-auto rounded-xl shadow-lg border border-white/5 my-6 md:my-8; }
|
||||
|
||||
/* Dynamic UI Components */
|
||||
.glass {
|
||||
background-color: color-mix(in srgb, var(--surface0) 60%, transparent);
|
||||
backdrop-filter: blur(12px);
|
||||
@@ -154,3 +121,18 @@ body {
|
||||
box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
.cm-s-narlblog.CodeMirror {
|
||||
background: var(--crust) !important;
|
||||
color: var(--text) !important;
|
||||
border: 1px solid var(--surface1);
|
||||
}
|
||||
.cm-s-narlblog .cm-header { color: var(--mauve) !important; }
|
||||
.cm-s-narlblog .cm-string { color: var(--green) !important; }
|
||||
.cm-s-narlblog .cm-keyword { color: var(--mauve) !important; font-weight: bold; }
|
||||
.cm-s-narlblog .CodeMirror-cursor { border-left-color: var(--text) !important; }
|
||||
|
||||
.hljs { color: var(--text) !important; background: transparent !important; }
|
||||
.hljs-keyword, .hljs-selector-tag { color: var(--mauve) !important; font-weight: bold; }
|
||||
.hljs-string { color: var(--green) !important; }
|
||||
.hljs-comment { color: var(--subtext0) !important; font-style: italic; }
|
||||
|
||||
Reference in New Issue
Block a user