Add Catppuccin themes: Mocha, Macchiato, Frappé, Latte variants
This commit is contained in:
@@ -6,7 +6,7 @@ A self-hosted ebook management system built with Go, PostgreSQL, HTMX, and Tailw
|
||||
|
||||
- **🔒 Multi-User Authentication**: Complete user system with registration/login, JWT-based sessions, and bcrypt password hashing
|
||||
- **✅ Server-Side Validation**: Comprehensive input validation with detailed error messages
|
||||
- **🌙 Multiple Themes**: 7 popular dark themes (Tokyo Night, Dracula, Nord, Solarized Dark, Monokai, One Dark Pro, Material Dark) with user preferences saved to database
|
||||
- **🌙 Multiple Themes**: 11 beautiful themes including Tokyo Night, Dracula, Nord, Solarized Dark, Monokai, One Dark Pro, Material Dark, and Catppuccin variants (Mocha, Macchiato, Frappé, Latte) with user preferences saved to database
|
||||
- **🎨 Theme Persistence**: User theme choices sync between browser and server
|
||||
- **📖 Reading Progress**: User-specific reading progress tracking
|
||||
- **🔧 RESTful API**: Clean API endpoints with JWT authentication
|
||||
@@ -119,7 +119,7 @@ Use the included Bruno collection in the `bruno/` directory for testing the API:
|
||||
- **Enhanced Security**: JWT authentication with theme persistence
|
||||
|
||||
### Frontend Redesign
|
||||
- **Multiple Themes**: 7 beautiful dark themes (Tokyo Night default) with CSS variables
|
||||
- **Multiple Themes**: 11 beautiful themes including Tokyo Night, Dracula, Nord, Solarized Dark, Monokai, One Dark Pro, Material Dark, and Catppuccin variants (Mocha, Macchiato, Frappé, Latte) with CSS variables
|
||||
- **HTMX Forms**: Real-time form submissions and updates without JavaScript frameworks
|
||||
- **Theme Switcher**: Dropdown selector that saves preferences to database
|
||||
- **Responsive Design**: Tailwind CSS for mobile-first responsive layouts
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{block "title" .}}Bookmann{{end}}</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
||||
<style>
|
||||
:root {
|
||||
--bg-primary: #1a1b26;
|
||||
--bg-secondary: #16161e;
|
||||
--text-primary: #a9b1d6;
|
||||
--text-secondary: #565f89;
|
||||
--accent: #7aa2f7;
|
||||
--border: #414868;
|
||||
}
|
||||
.theme-tokyo-night {
|
||||
--bg-primary: #1a1b26;
|
||||
--bg-secondary: #16161e;
|
||||
--text-primary: #a9b1d6;
|
||||
--text-secondary: #565f89;
|
||||
--accent: #7aa2f7;
|
||||
--border: #414868;
|
||||
}
|
||||
.theme-dracula {
|
||||
--bg-primary: #282a36;
|
||||
--bg-secondary: #21222c;
|
||||
--text-primary: #f8f8f2;
|
||||
--text-secondary: #6272a4;
|
||||
--accent: #bd93f9;
|
||||
--border: #44475a;
|
||||
}
|
||||
.theme-nord {
|
||||
--bg-primary: #2e3440;
|
||||
--bg-secondary: #3b4252;
|
||||
--text-primary: #eceff4;
|
||||
--text-secondary: #5e81ac;
|
||||
--accent: #88c0d0;
|
||||
--border: #4c566a;
|
||||
}
|
||||
.theme-solarized-dark {
|
||||
--bg-primary: #002b36;
|
||||
--bg-secondary: #073642;
|
||||
--text-primary: #93a1a1;
|
||||
--text-secondary: #586e75;
|
||||
--accent: #2aa198;
|
||||
--border: #586e75;
|
||||
}
|
||||
.theme-monokai {
|
||||
--bg-primary: #272822;
|
||||
--bg-secondary: #3e3d32;
|
||||
--text-primary: #f8f8f2;
|
||||
--text-secondary: #75715e;
|
||||
--accent: #a6e22e;
|
||||
--border: #49483e;
|
||||
}
|
||||
.theme-one-dark-pro {
|
||||
--bg-primary: #282c34;
|
||||
--bg-secondary: #21252b;
|
||||
--text-primary: #abb2bf;
|
||||
--text-secondary: #5c6370;
|
||||
--accent: #61dafb;
|
||||
--border: #3e4451;
|
||||
}
|
||||
.theme-material-dark {
|
||||
--bg-primary: #263238;
|
||||
--bg-secondary: #37474f;
|
||||
--text-primary: #eeffff;
|
||||
--text-secondary: #546e7a;
|
||||
--accent: #80cbc4;
|
||||
--border: #455a64;
|
||||
}
|
||||
.theme-catppuccin-mocha {
|
||||
--bg-primary: #1e1e2e;
|
||||
--bg-secondary: #181825;
|
||||
--text-primary: #cdd6f4;
|
||||
--text-secondary: #bac2de;
|
||||
--accent: #f38ba8;
|
||||
--border: #313244;
|
||||
}
|
||||
.theme-catppuccin-macchiato {
|
||||
--bg-primary: #24273a;
|
||||
--bg-secondary: #1e2030;
|
||||
--text-primary: #cad3f5;
|
||||
--text-secondary: #b8c0e0;
|
||||
--accent: #f0c6c6;
|
||||
--border: #363a4f;
|
||||
}
|
||||
.theme-catppuccin-frappe {
|
||||
--bg-primary: #303446;
|
||||
--bg-secondary: #292c3c;
|
||||
--text-primary: #c6d0f5;
|
||||
--text-secondary: #b5bfe2;
|
||||
--accent: #f2d5cf;
|
||||
--border: #414559;
|
||||
}
|
||||
.theme-catppuccin-latte {
|
||||
--bg-primary: #eff1f5;
|
||||
--bg-secondary: #e6e9ef;
|
||||
--text-primary: #4c4f69;
|
||||
--text-secondary: #5c5f77;
|
||||
--accent: #d20f39;
|
||||
--border: #bcc0cc;
|
||||
}
|
||||
body {
|
||||
background-color: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.card {
|
||||
background-color: var(--bg-secondary);
|
||||
border-color: var(--border);
|
||||
}
|
||||
.btn-primary {
|
||||
background-color: var(--accent);
|
||||
color: var(--bg-primary);
|
||||
}
|
||||
.btn-primary:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="theme-tokyo-night min-h-screen">
|
||||
{{block "content" .}}{{end}}
|
||||
<script>
|
||||
function applyTheme(theme) {
|
||||
document.body.className = `theme-${theme} min-h-screen`;
|
||||
localStorage.setItem('theme', theme);
|
||||
}
|
||||
function loadTheme() {
|
||||
const theme = localStorage.getItem('theme') || 'tokyo-night';
|
||||
applyTheme(theme);
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', loadTheme);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,97 @@
|
||||
{{template "base.html" .}}
|
||||
|
||||
{{define "title"}}Bookmann - Home{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<div class="flex justify-between items-center mb-8">
|
||||
<h1 class="text-4xl font-bold">Welcome to Bookmann</h1>
|
||||
<select id="theme-select" class="px-3 py-2 border rounded" onchange="changeTheme()">
|
||||
<option value="tokyo-night">Tokyo Night</option>
|
||||
<option value="dracula">Dracula</option>
|
||||
<option value="nord">Nord</option>
|
||||
<option value="solarized-dark">Solarized Dark</option>
|
||||
<option value="monokai">Monokai</option>
|
||||
<option value="one-dark-pro">One Dark Pro</option>
|
||||
<option value="material-dark">Material Dark</option>
|
||||
<option value="catppuccin-mocha">Catppuccin Mocha</option>
|
||||
<option value="catppuccin-macchiato">Catppuccin Macchiato</option>
|
||||
<option value="catppuccin-frappe">Catppuccin Frappé</option>
|
||||
<option value="catppuccin-latte">Catppuccin Latte</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div class="card p-6 rounded-lg shadow-md border">
|
||||
<h2 class="text-2xl font-semibold mb-4">Login</h2>
|
||||
<form hx-post="/api/auth/login" hx-target="#result" hx-swap="innerHTML">
|
||||
<div class="mb-4">
|
||||
<label class="block" style="color: var(--text-secondary)">Email or Username</label>
|
||||
<input type="text" name="login" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block" style="color: var(--text-secondary)">Password</label>
|
||||
<input type="password" name="password" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary px-4 py-2 rounded">
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card p-6 rounded-lg shadow-md border">
|
||||
<h2 class="text-2xl font-semibold mb-4">Register</h2>
|
||||
<form hx-post="/api/auth/register" hx-target="#result" hx-swap="innerHTML">
|
||||
<div class="mb-4">
|
||||
<label class="block" style="color: var(--text-secondary)">Email</label>
|
||||
<input type="email" name="email" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block" style="color: var(--text-secondary)">Username</label>
|
||||
<input type="text" name="username" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block" style="color: var(--text-secondary)">Password</label>
|
||||
<input type="password" name="password" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary px-4 py-2 rounded">
|
||||
Register
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="result" class="mt-8 text-center"></div>
|
||||
</div>
|
||||
<script>
|
||||
function changeTheme() {
|
||||
const theme = document.getElementById('theme-select').value;
|
||||
applyTheme(theme);
|
||||
// Save to server if logged in
|
||||
fetch('/api/auth/theme', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + localStorage.getItem('token')
|
||||
},
|
||||
body: JSON.stringify({ theme })
|
||||
}).catch(err => console.log('Theme save failed', err));
|
||||
}
|
||||
function loadUserTheme() {
|
||||
// If logged in, load from profile
|
||||
const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
fetch('/api/auth/profile', {
|
||||
headers: { 'Authorization': 'Bearer ' + token }
|
||||
}).then(res => res.json()).then(data => {
|
||||
if (data.theme) applyTheme(data.theme);
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadTheme();
|
||||
loadUserTheme();
|
||||
document.getElementById('theme-select').value = localStorage.getItem('theme') || 'tokyo-night';
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
@@ -0,0 +1,65 @@
|
||||
{{template "base.html" .}}
|
||||
|
||||
{{define "title"}}Login{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div class="container mx-auto px-4 py-8 max-w-md">
|
||||
<div class="flex justify-between items-center mb-8">
|
||||
<h1 class="text-3xl font-bold">Login</h1>
|
||||
<select id="theme-select" class="px-3 py-2 border rounded" style="background-color: var(--bg-secondary); color: var(--text-primary); border-color: var(--border)" onchange="changeTheme()">
|
||||
<option value="tokyo-night">Tokyo Night</option>
|
||||
<option value="dracula">Dracula</option>
|
||||
<option value="nord">Nord</option>
|
||||
<option value="solarized-dark">Solarized Dark</option>
|
||||
<option value="monokai">Monokai</option>
|
||||
<option value="one-dark-pro">One Dark Pro</option>
|
||||
<option value="material-dark">Material Dark</option>
|
||||
<option value="catppuccin-mocha">Catppuccin Mocha</option>
|
||||
<option value="catppuccin-macchiato">Catppuccin Macchiato</option>
|
||||
<option value="catppuccin-frappe">Catppuccin Frappé</option>
|
||||
<option value="catppuccin-latte">Catppuccin Latte</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<form hx-post="/api/auth/login" hx-target="#result" hx-swap="innerHTML" class="card p-6 rounded-lg shadow-md border">
|
||||
<div class="mb-4">
|
||||
<label class="block mb-2" style="color: var(--text-secondary)">Email or Username</label>
|
||||
<input type="text" name="login" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block mb-2" style="color: var(--text-secondary)">Password</label>
|
||||
<input type="password" name="password" class="w-full px-3 py-2 border rounded" style="background-color: var(--bg-primary); color: var(--text-primary); border-color: var(--border)" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary w-full py-2 rounded">
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div id="result" class="mt-4 text-center"></div>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<a href="/register" class="text-blue-500 hover:underline">Don't have an account? Register</a>
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
function changeTheme() {
|
||||
const theme = document.getElementById('theme-select').value;
|
||||
applyTheme(theme);
|
||||
const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
fetch('/api/auth/theme', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + token
|
||||
},
|
||||
body: JSON.stringify({ theme })
|
||||
}).catch(err => console.log('Theme save failed', err));
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadTheme();
|
||||
document.getElementById('theme-select').value = localStorage.getItem('theme') || 'tokyo-night';
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{template "base.html" .}}
|
||||
|
||||
{{define "title"}}Register{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div class="container mx-auto px-4 py-8 max-w-md">
|
||||
<h1 class="text-3xl font-bold text-center mb-8">Register</h1>
|
||||
|
||||
<form hx-post="/api/auth/register" hx-target="#result" hx-swap="innerHTML" class="bg-white p-6 rounded-lg shadow-md">
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-2">Email</label>
|
||||
<input type="email" name="email" class="w-full px-3 py-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-2">Username</label>
|
||||
<input type="text" name="username" class="w-full px-3 py-2 border rounded" required>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-gray-700 mb-2">Password</label>
|
||||
<input type="password" name="password" class="w-full px-3 py-2 border rounded" required>
|
||||
</div>
|
||||
<button type="submit" class="w-full bg-green-500 text-white py-2 rounded hover:bg-green-600">
|
||||
Register
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div id="result" class="mt-4 text-center"></div>
|
||||
|
||||
<p class="text-center mt-4">
|
||||
<a href="/login" class="text-blue-500 hover:underline">Already have an account? Login</a>
|
||||
</p>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -28,7 +28,7 @@ docs {
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Request Body:**
|
||||
- `theme` (string): Theme name (tokyo-night, dracula, nord, solarized-dark, monokai, one-dark-pro, material-dark)
|
||||
- `theme` (string): Theme name (tokyo-night, dracula, nord, solarized-dark, monokai, one-dark-pro, material-dark, catppuccin-mocha, catppuccin-macchiato, catppuccin-frappe, catppuccin-latte)
|
||||
|
||||
**Response:**
|
||||
- `message` (string): Success message
|
||||
|
||||
Reference in New Issue
Block a user