---
title: "Dark mode and theming · vuejs.school"
description: "Name colours by role as CSS custom properties, offer light, dark and system with useColorMode(), and set the theme before the first paint so the page never flashes."
canonical_url: "https://vuejs.school/learn/styling/dark-mode-and-theming"
meta:
  "og:description": "Name colours by role as CSS custom properties, offer light, dark and system with useColorMode(), and set the theme before the first paint so the page never flashes."
  "og:image": "https://vuejs.school/_og/d/a_~RGFyayBtb2RlIGFuZCB0aGVtaW5nIMK3IHZ1ZWpzLnNjaG9vbA%2Cc_OgCard.takumi%2Ctitle_Dark%2Bmode%2Band%2Btheming%2Cdescription_~TmFtZSBjb2xvdXJzIGJ5IHJvbGUgYXMgQ1NTIGN1c3RvbSBwcm9wZXJ0aWVzLCBvZmZlciBsaWdodCwgZGFyayBhbmQgc3lzdGVtIHdpdGggdXNlQ29sb3JNb2RlKCksIGFuZCBzZXQgdGhlIHRoZW1lIGJlZm9yZSB0aGUgZmlyc3QgcGFpbnQgc28gdGhlIHBhZ2UgbmV2ZXIgZmxhc2hlcy4%2Ceyebrow_~U3R5bGluZyAmIFVJIMK3IExlc3NvbiAyIG9mIDU%2Ctint_lilac%2Cp_Ii9sZWFybi9zdHlsaW5nL2RhcmstbW9kZS1hbmQtdGhlbWluZyI%2Cs_JuGVvk5q5J6L1l_I.png"
  "og:image:alt": "Dark mode and theming · vuejs.school"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Dark mode and theming · vuejs.school"
  "twitter:image": "https://vuejs.school/_og/d/a_~RGFyayBtb2RlIGFuZCB0aGVtaW5nIMK3IHZ1ZWpzLnNjaG9vbA%2Cc_OgCard.takumi%2Ctitle_Dark%2Bmode%2Band%2Btheming%2Cdescription_~TmFtZSBjb2xvdXJzIGJ5IHJvbGUgYXMgQ1NTIGN1c3RvbSBwcm9wZXJ0aWVzLCBvZmZlciBsaWdodCwgZGFyayBhbmQgc3lzdGVtIHdpdGggdXNlQ29sb3JNb2RlKCksIGFuZCBzZXQgdGhlIHRoZW1lIGJlZm9yZSB0aGUgZmlyc3QgcGFpbnQgc28gdGhlIHBhZ2UgbmV2ZXIgZmxhc2hlcy4%2Ceyebrow_~U3R5bGluZyAmIFVJIMK3IExlc3NvbiAyIG9mIDU%2Ctint_lilac%2Cp_Ii9sZWFybi9zdHlsaW5nL2RhcmstbW9kZS1hbmQtdGhlbWluZyI%2Cs_JuGVvk5q5J6L1l_I.png"
  "twitter:image:alt": "Dark mode and theming · vuejs.school"
---

> Index of every page on this site: [llms.txt](https://vuejs.school/llms.txt)

# **Dark mode and theming**

Name colours by role as CSS custom properties, offer light, dark and system with useColorMode(), and set the theme before the first paint so the page never flashes.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://vuejs.school/#website","@type":"WebSite","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school/","publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#webpage","@type":"WebPage","description":"Name colours by role as CSS custom properties, offer light, dark and system with useColorMode(), and set the theme before the first paint so the page never flashes.","name":"Dark mode and theming","url":"https://vuejs.school/learn/styling/dark-mode-and-theming","breadcrumb":{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#breadcrumb"},"isPartOf":{"@id":"https://vuejs.school/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://vuejs.school/learn/styling/dark-mode-and-theming"]}],"primaryImageOfPage":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/#identity","@type":"Organization","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school","logo":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#article","description":"Name colours by role as CSS custom properties, offer light, dark and system with useColorMode(), and set the theme before the first paint so the page never flashes.","headline":"Dark mode and theming","inLanguage":"en","isAccessibleForFree":true,"thumbnailUrl":"https://vuejs.school/_og/d/a_~RGFyayBtb2RlIGFuZCB0aGVtaW5nIMK3IHZ1ZWpzLnNjaG9vbA%2Cc_OgCard.takumi%2Ctitle_Dark%2Bmode%2Band%2Btheming%2Cdescription_~TmFtZSBjb2xvdXJzIGJ5IHJvbGUgYXMgQ1NTIGN1c3RvbSBwcm9wZXJ0aWVzLCBvZmZlciBsaWdodCwgZGFyayBhbmQgc3lzdGVtIHdpdGggdXNlQ29sb3JNb2RlKCksIGFuZCBzZXQgdGhlIHRoZW1lIGJlZm9yZSB0aGUgZmlyc3QgcGFpbnQgc28gdGhlIHBhZ2UgbmV2ZXIgZmxhc2hlcy4%2Ceyebrow_~U3R5bGluZyAmIFVJIMK3IExlc3NvbiAyIG9mIDU%2Ctint_lilac%2Cp_Ii9sZWFybi9zdHlsaW5nL2RhcmstbW9kZS1hbmQtdGhlbWluZyI%2Cs_JuGVvk5q5J6L1l_I.png","@type":["Article","TechArticle"],"articleSection":["Styling"],"author":{"@id":"https://vuejs.school/#identity"},"image":{"@id":"https://vuejs.school/#/schema/image/1"},"isPartOf":{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#webpage"},"keywords":["CSS custom properties","useColorMode()","prefers-color-scheme","color-scheme"],"mainEntityOfPage":{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#webpage"},"publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/styling/dark-mode-and-theming#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Skill tree","item":"https://vuejs.school/track","position":1},{"@type":"ListItem","name":"Styling & UI","item":"https://vuejs.school/track/styling","position":2},{"@type":"ListItem","name":"Dark mode and theming","position":3}]},{"@id":"https://vuejs.school/#logo","@type":"ImageObject","caption":"vuejs.school","contentUrl":"https://vuejs.school/apple-touch-icon.png","inLanguage":"en","url":"https://vuejs.school/apple-touch-icon.png"},{"@id":"https://vuejs.school/#/schema/image/1","@type":"ImageObject","contentUrl":"https://vuejs.school/_og/d/a_~RGFyayBtb2RlIGFuZCB0aGVtaW5nIMK3IHZ1ZWpzLnNjaG9vbA%2Cc_OgCard.takumi%2Ctitle_Dark%2Bmode%2Band%2Btheming%2Cdescription_~TmFtZSBjb2xvdXJzIGJ5IHJvbGUgYXMgQ1NTIGN1c3RvbSBwcm9wZXJ0aWVzLCBvZmZlciBsaWdodCwgZGFyayBhbmQgc3lzdGVtIHdpdGggdXNlQ29sb3JNb2RlKCksIGFuZCBzZXQgdGhlIHRoZW1lIGJlZm9yZSB0aGUgZmlyc3QgcGFpbnQgc28gdGhlIHBhZ2UgbmV2ZXIgZmxhc2hlcy4%2Ceyebrow_~U3R5bGluZyAmIFVJIMK3IExlc3NvbiAyIG9mIDU%2Ctint_lilac%2Cp_Ii9sZWFybi9zdHlsaW5nL2RhcmstbW9kZS1hbmQtdGhlbWluZyI%2Cs_JuGVvk5q5J6L1l_I.png","inLanguage":"en","url":"https://vuejs.school/_og/d/a_~RGFyayBtb2RlIGFuZCB0aGVtaW5nIMK3IHZ1ZWpzLnNjaG9vbA%2Cc_OgCard.takumi%2Ctitle_Dark%2Bmode%2Band%2Btheming%2Cdescription_~TmFtZSBjb2xvdXJzIGJ5IHJvbGUgYXMgQ1NTIGN1c3RvbSBwcm9wZXJ0aWVzLCBvZmZlciBsaWdodCwgZGFyayBhbmQgc3lzdGVtIHdpdGggdXNlQ29sb3JNb2RlKCksIGFuZCBzZXQgdGhlIHRoZW1lIGJlZm9yZSB0aGUgZmlyc3QgcGFpbnQgc28gdGhlIHBhZ2UgbmV2ZXIgZmxhc2hlcy4%2Ceyebrow_~U3R5bGluZyAmIFVJIMK3IExlc3NvbiAyIG9mIDU%2Ctint_lilac%2Cp_Ii9sZWFybi9zdHlsaW5nL2RhcmstbW9kZS1hbmQtdGhlbWluZyI%2Cs_JuGVvk5q5J6L1l_I.png"}]}
```