Theme Customization
GitScope includes a built-in dark/light theme system with automatic persistence and smooth transitions. Switch between themes instantly with a single click.Theme Toggle
The theme toggle is located in the application header (top-right corner):src/App.jsx
Toggle Button Component
src/components/Header.jsx
- Moon icon (🌙) in light mode - click to switch to dark
- Sun icon (☀️) in dark mode - click to switch to light
Icons are provided by the
lucide-react package, ensuring crisp SVG rendering at any size.Theme Persistence
GitScope automatically saves your theme preference to localStorage:src/App.jsx
How It Works
Initial Load
On app mount, the theme is loaded from localStorage:If no saved theme exists, defaults to
'light'.DOM Update
The theme is applied to the document root via a data attribute:This allows CSS to target
[data-theme="dark"] selectors.The theme state is initialized lazily using the functional form of
useState to avoid reading from localStorage on every render.CSS Variables System
GitScope uses CSS custom properties (variables) for theming, defined insrc/index.css.
Light Theme (Default)
src/index.css
Dark Theme
src/index.css
Variable Categories
The CSS variable system is organized into logical groups:Background Colors
| Variable | Purpose | Light | Dark |
|---|---|---|---|
--bg | Main page background | #f6f8fa | #0d1117 |
--bg-card | Card/panel backgrounds | #ffffff | #161b22 |
--bg-hover | Hover states | #f0f3f7 | #1c232d |
Text Colors
| Variable | Purpose | Light | Dark |
|---|---|---|---|
--text | Primary text | #1a2332 | #e6edf3 |
--text-muted | Secondary text | #6b7c93 | #8b949e |
--text-dim | Tertiary/subtle text | #9aabb8 | #484f58 |
Accent Colors
| Variable | Purpose | Light | Dark |
|---|---|---|---|
--accent | Links, buttons, focus | #2563eb | #58a6ff |
--accent-soft | Accent backgrounds | #eff6ff | #0d2044 |
--accent-hover | Hover states | #1d4ed8 | #79b8ff |
Status Colors
Status colors are used throughout the app for visual feedback (rate limits, success states, warnings, errors).
| Variable | Purpose | Light | Dark |
|---|---|---|---|
--green | Success, healthy | #10b981 | #3fb950 |
--yellow | Warning, caution | #f59e0b | #d29922 |
--red | Error, critical | #ef4444 | #f85149 |
--purple | Special highlights | #8b5cf6 | #bc8cff |
Soft Backgrounds
Each status color has a corresponding soft background:Shadows and Layout
| Variable | Purpose | Value |
|---|---|---|
--shadow | Standard elevation | Different opacity for light/dark |
--shadow-lg | High elevation (modals) | Different opacity for light/dark |
--border | Border color | #e1e7ef / #30363d |
--radius | Standard border radius | 12px |
--radius-sm | Small border radius | 8px |
Typography
| Variable | Purpose | Value |
|---|---|---|
--font | Primary font family | 'DM Sans', sans-serif |
--font-mono | Monospace font (code) | 'Space Mono', monospace |
Transitions
Smooth Transitions
The body element includes transition properties for seamless theme switching:src/index.css
The
200ms ease transition ensures background and text colors fade smoothly when toggling themes, preventing jarring flashes.Using Theme Variables
All components reference CSS variables instead of hardcoded colors:Example: Card Styling
Example: Dynamic Rate Limit Colors
The rate limit indicator uses theme-aware colors:src/components/Header.jsx
CSS Modules Integration
GitScope uses CSS Modules for component-scoped styles, but still references global theme variables:Header.module.css
CSS Modules prevent class name collisions while still allowing global theme variables to cascade throughout the app.
Theme Detection
While GitScope doesn’t currently implement system theme detection, you can extend it easily:Customizing Colors
To customize the theme colors:Edit CSS Variables
Open
src/index.css and modify the values in :root (light theme) or [data-theme="dark"] (dark theme).Maintain Contrast
Ensure sufficient contrast ratios for accessibility:
- Normal text: 4.5:1 minimum
- Large text: 3:1 minimum
- Interactive elements: 3:1 minimum
Accessibility Considerations
Troubleshooting
Theme Not Persisting
- Check if localStorage is enabled in your browser
- Ensure you’re not in incognito/private mode (some browsers restrict localStorage)
- Verify the key
'theme'exists in localStorage (DevTools → Application → Local Storage)
Theme Not Applying
- Inspect
<html>element and verifydata-themeattribute is present - Check browser console for errors during theme initialization
- Clear browser cache and reload
Colors Look Wrong
- Verify CSS variables are correctly defined in
src/index.css - Check that components reference
var(--variableName)not hardcoded colors - Ensure CSS Modules are importing global variables correctly
Toggle Button Not Working
- Check that
toggleThemefunction is properly passed toHeadercomponent - Verify
onClickhandler is attached to the button - Look for JavaScript errors in browser console
Next Steps
API Token Setup
Configure your GitHub token to unlock full functionality
Rate Limits
Learn how GitScope tracks API consumption