Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,21 @@ function applyFilters() {
gridEl.innerHTML = '<p>Failed to load projects list.</p>';
}
})();


const themeToggle = document.getElementById('themeToggle');
const body = document.body;


const currentTheme = localStorage.getItem('theme') || 'light';
if (currentTheme === 'dark') {
body.classList.add('dark-mode');
}

themeToggle.addEventListener('click', () => {
body.classList.toggle('dark-mode');


const theme = body.classList.contains('dark-mode') ? 'dark' : 'light';
localStorage.setItem('theme', theme);
});
110 changes: 100 additions & 10 deletions assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@
--accent-2: #93c5fd
}


body:not(.dark-mode) {
--bg: #f8f9fa;
--card: #ffffff;
--text: #1a1a1a;
--muted: #6b7280;
--bg-gradient-start: #f0f4f8;
--bg-gradient-end: #e2e8f0;
--border: #e5e7eb;
--input-bg: #ffffff;
}


body.dark-mode {
--bg: #0f0f12;
--card: #17171c;
--text: #eef1f8;
--muted: #a6adbb;
--bg-gradient-start: #0b0b0e;
--bg-gradient-end: #121217;
--border: #262631;
--input-bg: #0e0e13;
}

* {
box-sizing: border-box
}
Expand All @@ -19,13 +43,15 @@ body {

body {
font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
background: linear-gradient(180deg, #0b0b0e, #121217);
color: var(--text)
background: linear-gradient(180deg, var(--bg-gradient-start, #0b0b0e), var(--bg-gradient-end, #121217));
color: var(--text);
transition: background 0.3s ease, color 0.3s ease;
}

.site-header {
padding: 2rem 1rem;
text-align: center
text-align: center;
position: relative;
}

.site-header h1 {
Expand All @@ -42,16 +68,69 @@ body {
display: flex;
gap: .5rem;
justify-content: center;
flex-wrap: wrap
flex-wrap: wrap;
align-items: center;
}

.controls input,
.controls select {
padding: .5rem .75rem;
border-radius: .5rem;
border: 1px solid #2a2a33;
background: #0e0e13;
color: var(--text)
border: 1px solid var(--border, #2a2a33);
background: var(--input-bg, #0e0e13);
color: var(--text);
transition: background 0.3s ease, border-color 0.3s ease;
}


.theme-toggle {
background: var(--card);
border: 2px solid var(--border, #262631);
border-radius: 50%;
width: 50px;
height: 50px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
position: fixed;
top: 1rem;
right: 1rem;
z-index: 1000;
color: var(--text);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
transform: rotate(15deg) scale(1.1);
border-color: var(--accent);
box-shadow: 0 6px 16px rgba(110, 231, 183, 0.2);
}

.theme-toggle svg {
position: absolute;
transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
opacity: 0;
transform: rotate(90deg);
}

.theme-toggle .moon-icon {
opacity: 1;
transform: rotate(0deg);
}

body:not(.dark-mode) .theme-toggle .sun-icon {
opacity: 1;
transform: rotate(0deg);
}

body:not(.dark-mode) .theme-toggle .moon-icon {
opacity: 0;
transform: rotate(-90deg);
}

.project-grid {
Expand All @@ -65,10 +144,11 @@ body {

.card {
background: var(--card);
border: 1px solid #262631;
border: 1px solid var(--border, #262631);
border-radius: .75rem;
padding: 1rem;
box-shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset
box-shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset;
transition: background 0.3s ease, border-color 0.3s ease;
}

.card h3 {
Expand Down Expand Up @@ -110,5 +190,15 @@ body {
padding: 2rem 1rem;
text-align: center;
color: var(--muted);
border-top: 1px solid #22222b
border-top: 1px solid var(--border, #22222b);
transition: border-color 0.3s ease;
}

.site-footer a {
color: var(--accent);
text-decoration: none;
}

.site-footer a:hover {
text-decoration: underline;
}
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ <h1>Vanilla Verse</h1>
<option value="visual">Fun UI / Visual</option>
<option value="data">Mini Data</option>
</select>
<button id="themeToggle" class="theme-toggle" aria-label="Toggle theme">
<svg class="sun-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/>
<line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/>
<line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
<svg class="moon-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
</button>
</div>
</header>

Expand All @@ -37,6 +53,7 @@ <h1>Vanilla Verse</h1>
</footer>

<script src="assets/main.js" type="module"></script>

</body>

</html>