Implementing Dark/Light mode in your Vue Vite Application

Implementing Dark/Light mode in your Vue Vite Application

In this article we will be implementing the dark/light mode feature into our Vue Vite application without using any library.

We will start by creating a simple Vite application and then setup a simple user interface for our application. Before creating our Vue Application, i would like to mention about some great Free Vue Templates from WrapPixel, they are free to download and use for personal as well as commercial use. They can save your tons of time as you can use their stunning user interfaces directly in your project, which will give amazing look & feel to your application. So do check them out.

Creating A Vuejs Vite Application

To setup a Vite application, open up your terminal and type the following:

npm init vite-app themeswitcher

This command will scaffold a new vite application, We will have to move into the project directory and install the project dependencies:

cd themeswitcher
npm install

After installation, we can now run our application using the npm run dev command:

code . && npm run dev

The code . command will open up our application in VS Code.

Our application will now be running on port 3000.


With our application up and running we can now create our css asset. Create a css/dark.css file inside the public directory. This is where we will be storing all our css code for our dark mode environment.

Please continue reading from WrapPixel - https://www.wrappixel.com/implementing-dark-light-mode-in-your-vue-vite-application/

要查看或添加评论,请登录

Sunil Joshi的更多文章

  • How to become a Kickass Web Developer in 2021 [Frontend & Backend Tips]

    How to become a Kickass Web Developer in 2021 [Frontend & Backend Tips]

    Alright then, so you have decided your path. You want to become a web developer this year.

  • Top 42 React resources every developer should bookmark [Latest]

    Top 42 React resources every developer should bookmark [Latest]

    Every developer needs resources! Whether you are just starting learning the most popular JavaScript library or you’re…

  • The Ultimate React Cheat Sheet

    The Ultimate React Cheat Sheet

    React is an open-source, front-end, JavaScript library for building user interfaces or UI components. Just like Vuejs…

  • Angular Cheat Sheet

    Angular Cheat Sheet

    Angular is a TypeScript based open-source web application framework used in building both web and mobile based…

  • What the heck is Vue Vite?

    What the heck is Vue Vite?

    Vite is a Lightening fast cold server that offers instant hot modules replacement and True on demand compilation.This…

  • What is React? Why developers are choosing it over other Frameworks?

    What is React? Why developers are choosing it over other Frameworks?

    We have been witnessing the epic growth in technology within a decade. But what excites us mesmerising ability and…

  • Vue Lifecycle Hooks

    Vue Lifecycle Hooks

    In this tutorial you will learn and gain understanding of Vue.js lifecycle Hooks.

  • Nuxt.js Cheat Sheet

    Nuxt.js Cheat Sheet

    In this article, we will looking into some of the Nuxt essential and how we can use them in our application. It’s…

  • The Ultimate Vue Cheat Sheet

    The Ultimate Vue Cheat Sheet

    Vuejs has become one of the most successfully applied, loved and trusted frontend JavaScript frameworks among our…

  • Implementing Drag and Drop in Vue

    Implementing Drag and Drop in Vue

    In this article we will be implementing something fun. We will be implementing the drag and drop feature in Vuejs.

社区洞察

其他会员也浏览了