Skip to content
Home » Blog » React Series #06: How to change the default dark theme in next.js project

React Series #06: How to change the default dark theme in next.js project

When you create a new project in next.js it will fire up a default page which will have a dark theme as default. Make these changes to make the light background.

open app/global.css

:root {
  --foreground-rgb: 0, 0, 0;
  --background-start-rgb: 214, 219, 220;
  --background-end-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
  :root {
    --foreground-rgb: 255, 255, 255;
    --background-start-rgb: 0, 0, 0;
    --background-end-rgb: 0, 0, 0;
  }
}

To

:root {
  --foreground-rgb: 0, 0, 0;
}

@media (prefers-color-scheme: light) {
  :root {
    --foreground-rgb: 255, 255, 255;
  }
}

You can adjust the background color as per your project needs.

Leave a Reply

Your email address will not be published. Required fields are marked *