--- id: w3css-dark-mode title: "W3CSS Dark Mode" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["dark mode toggle", "classList.toggle", "W3.CSS 닀크λͺ¨λ“œ"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.86 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["w3css", "css-framework", "w3schools", "dark-mode", "javascript"] raw_sources: ["https://www.w3schools.com/w3css/w3css_darkmode.asp"] applied_in: [] github_commit: "" --- # [[W3CSS Dark Mode]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) W3.CSS has no dedicated "dark mode system" at all β€” the entire feature is just one line of vanilla JavaScript (`document.body.classList.toggle("w3-black")`) reusing the SAME `w3-black` color utility class that exists for ordinary styling, showing that a UI framework doesn't need special-purpose infrastructure to support a feature if its utility classes are composable enough. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **No dedicated dark-mode API** β€” dark mode is achieved by toggling an ordinary color class, not a purpose-built framework feature. [S1] - **`classList.toggle("w3-black")`** β€” native JavaScript DOM API that adds the class if absent, removes it if present β€” the toggle behavior needs zero custom logic. [S1] - **`document.body`** β€” the toggle target is typically the whole page body, switching the entire page's background. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Full dark-mode toggle implementation: `` β€” attached to a button's `onclick`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - ν˜„μž¬κΉŒμ§€ 발견된 λͺ¨μˆœ 사항 μ—†μŒ (No contradictions found in available sources). ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 색상 μœ ν‹Έλ¦¬ν‹° 클래슀λ₯Ό ν† κΈ€ν•˜λŠ” κ²ƒλ§ŒμœΌλ‘œ 닀크λͺ¨λ“œλ₯Ό κ΅¬ν˜„ν•˜λŠ” μ΅œμ†Œμ£Όμ˜ νŒ¨ν„΄μ΄ μ‹€μ „μ—μ„œ κ·ΈλŒ€λ‘œ μž¬μ‚¬μš© κ°€λŠ₯ν•œ 기법이닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Toggling dark mode by reusing an ordinary color utility class (JavaScript): ```html ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.86 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[W3.CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[W3CSS Colors]], [[W3CSS Animate]] - **μ°Έμ‘° λ§₯락:** Effects μ„Ήμ…˜ 첫 ν•­λͺ© β€” μ• λ‹ˆλ©”μ΄μ…˜(Animate) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” W3.CSS Dark Mode β€” https://www.w3schools.com/w3css/w3css_darkmode.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "W3.CSS Dark Mode" page (Astra wiki-curation, P-Reinforce v3.1 format).