Skip to content

Commit d575845

Browse files
author
RBraga
committed
feat: light/dark mode toggle + dynamic star count
1 parent c0991b2 commit d575845

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

‎docs/index.html‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,47 @@
3131
--shadow: 0 4px 24px rgba(0,0,0,.4);
3232
--shadow-lg: 0 12px 48px rgba(0,0,0,.6);
3333
}
34+
/* ── LIGHT MODE ── */
35+
[data-theme="light"] {
36+
--bg: #f8fafc;
37+
--bg2: #f1f5f9;
38+
--surface: #ffffff;
39+
--border: rgba(0,0,0,.08);
40+
--border2: rgba(0,0,0,.14);
41+
--text: #1e293b;
42+
--shadow: 0 4px 24px rgba(0,0,0,.08);
43+
--shadow-lg: 0 12px 48px rgba(0,0,0,.15);
44+
}
45+
[data-theme="light"] nav {
46+
background: rgba(248,250,252,.92);
47+
border-bottom-color: rgba(0,0,0,.1);
48+
}
49+
[data-theme="light"] .nav-logo-text { color: #0f172a; }
50+
[data-theme="light"] .section h2 { color: #0f172a; }
51+
[data-theme="light"] .hero-bg { opacity: .5; }
52+
[data-theme="light"] .hero-grid { opacity: .3; }
53+
[data-theme="light"] .btn-github { background: #0f172a; color: #fff; }
54+
[data-theme="light"] .cmp.before { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.3); }
55+
[data-theme="light"] .cmp.after { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.3); }
56+
[data-theme="light"] .faq-item { background: var(--surface); border-color: var(--border); }
57+
[data-theme="light"] .skill-card,
58+
[data-theme="light"] .agent-card,
59+
[data-theme="light"] .gate-card,
60+
[data-theme="light"] .ack-card { background: var(--surface); border-color: var(--border); }
61+
[data-theme="light"] .hero-stat { background: var(--surface); }
62+
.theme-toggle {
63+
background: none;
64+
border: 1px solid var(--border2);
65+
border-radius: 8px;
66+
padding: 6px 10px;
67+
cursor: pointer;
68+
font-size: .9rem;
69+
line-height: 1;
70+
transition: background .15s;
71+
}
72+
.theme-toggle:hover { background: rgba(255,255,255,.08); }
73+
[data-theme="light"] .theme-toggle:hover { background: rgba(0,0,0,.06); }
74+
3475

3576
html { scroll-behavior: smooth; }
3677
body {
@@ -353,6 +394,9 @@
353394
.skill-row { grid-template-columns:1fr; gap:10px; }
354395
}
355396
</style>
397+
<script>
398+
(function(){var s=localStorage.getItem('theme'),d=window.matchMedia('(prefers-color-scheme:dark)').matches;document.documentElement.setAttribute('data-theme',s||(d?'dark':'light'));})();
399+
</script>
356400
</head>
357401
<body>
358402

@@ -364,6 +408,8 @@
364408
<span class="nav-logo-badge">v1.0.0</span>
365409
</a>
366410
<div class="nav-right">
411+
<button class="theme-toggle" id="themeToggle" aria-label="Toggle theme">🌙</button>
412+
367413
<a class="btn-github" href="https://github.com/RBraga01/builder-product" target="_blank" rel="noopener">
368414
<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
369415
GitHub
@@ -684,5 +730,28 @@ <h3>builder-growth</h3>
684730
);
685731
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));
686732
</script>
733+
<script>
734+
fetch('https://api.github.com/repos/RBraga01/builder-product')
735+
.then(r => r.json())
736+
.then(data => {
737+
document.querySelectorAll('.star-count').forEach(el => {
738+
el.textContent = data.stargazers_count + ' ⭐';
739+
});
740+
})
741+
.catch(() => {});
742+
document.addEventListener('DOMContentLoaded', function() {
743+
var btn = document.getElementById('themeToggle');
744+
function upd() {
745+
btn.textContent = document.documentElement.getAttribute('data-theme') === 'dark' ? '☀️' : '🌙';
746+
}
747+
upd();
748+
btn.addEventListener('click', function() {
749+
var t = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
750+
document.documentElement.setAttribute('data-theme', t);
751+
localStorage.setItem('theme', t);
752+
upd();
753+
});
754+
});
755+
</script>
687756
</body>
688757
</html>

0 commit comments

Comments
 (0)