lidge-jun/codexclaw / plugins/codexclaw/skills/dev-frontend
cxc-dev-frontend
UnverifiedUse for frontend code and UI fixes. Triggers: CSS, responsive, animation, React, Vue, Svelte, Tailwind, redesign, anti-slop, 프론트엔드, UI 작업, 반응형, 디자인 수정.
references/core/theme-switching.md
View on GitHub# Theme / Dark Mode
## Implementation
Use `data-theme` attribute on `<html>`, not class-based toggle.
```css
:root {
--bg-primary: oklch(98% 0 0);
--text-primary: oklch(15% 0 0);
}
:root[data-theme="dark"] {
--bg-primary: oklch(12% 0 0);
--text-primary: oklch(92% 0 0);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme]) {
--bg-primary: oklch(12% 0 0);
--text-primary: oklch(92% 0 0);
}
}
```
- `data-theme` takes precedence over media query
- System preference is the fallback when no explicit choice
- All colors MUST use CSS custom properties
(token layering + `oklch()`/`light-dark()` mechanics: `color-system.md`)
## Flash of Wrong Theme (FOWT) Prevention
```html
<script>
(function() {
var t = localStorage.getItem('theme');
if (t === 'dark' || t === 'light') {
document.documentElement.setAttribute('data-theme', t);
}
})();
</script>
```
- Inline in `<head>`, before any stylesheet (< 200 bytes)
- SSR: read theme cookie server-side, set `data-theme` in HTML response
## Toggle Component
Three states: Light → Dark → System → Light.
- Store: `localStorage.setItem('theme', 'dark' | 'light' | 'system')`
- `system` removes `data-theme`, lets media query decide
- Accessible: `role="button"`, `aria-label="Switch to dark theme"`
- Position: header or settings, never hidden in submenu
## Theme Transition
```css
:root[data-theme-transitioning] * {
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}
```
- Add transitioning attribute on toggle, remove after 200ms
- Only transition color properties
- Respect `prefers-reduced-motion`: skip transition
- Never animate on page load
## Component Checklist
- [ ] All colors use custom properties
- [ ] Shadows lighter in dark mode
- [ ] White-background images get border in dark mode
- [ ] SVG icons use `currentColor`
- [ ] Borders use surface-level difference in dark mode
- [ ] Charts/data-viz legible in both themes
- [ ] Form inputs have sufficient contrast in both themes
## Cross-references
- Dark token derivation: `dev-uiux-design/references/color-system.md`
- One theme per page: `consistency-locks.md`
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |