Easily change the colors of your application programmatically. Rebuild the default stylesheet and customize various aspects of the framework for your particular needs. If you are looking for the Theme Generator, please navigate here.
Discover and generate new color themes for your Vuetify applications using our Theme Generator tool.
Light and Dark
Vuetify supports both light and dark variants of the Material Design spec. This designation starts at the root application component,
v-app and is supported by majority of components. By default, your application will use the light theme, but this can be easily overwritten by adding the dark prop.
When you designate a component as light or dark, all of its children will inherit and apply the same unless otherwise specified. Due to CSS specificity, there are certain combinations that might prompt you to manually assign the theme for nested children. This is most likely to occur when using the dark theme.
By default, Vuetify has a standard theme applied for all components.
This can be easily changed. Simply pass a theme property to the
Vue.use function. You can choose to modify all or only some of the theme properties, with the remaining inheriting from the default.
You can also use the pre-defined material colors.
Under the hood, Vuetify will generate css classes based upon these values that will be accessible in the DOM. These classes will follow the same markup as other helper classes,
secondary--text for example. If you supply an entire color object (as in
colors.purple above), the lighten/darken variations will be used directly instead of being generated.
These values will also be made available on the instance $vuetify object under the theme property. This allows you to dynamically modify your theme. Behind the scenes, Vuetify will regenerate and update your theme classes, seamlessly updating your application.
Custom theme variants
While Vuetify automatically generates lighten and darken variants for theme colors, you may want to control this yourself. Simply pass a theme object that contains the variants that you wish to modify. Anything not provided will still be generated for you.
You can now import your custom theme object and apply it to Vuetify
Below is a full list of the overwritable keys on the theme object:
Vuetify generates theme styles at run-time for SPA's and server side for SSR applications. The generated styles will be placed in a
<style> tag with the id of vuetify-theme-stylesheet.
For SSR applications, you can pass a callback function to $vuetify.options.minifyTheme to reduce the initial page size. When using this option, it is recommended to also use themeCache.
A custom caching object can be provided (works in tandem with minifyTheme) to increase SSR efficiency. The object must contain a get and a set method. Below is an example using LRU cache.
customProperties will also generate a css variable for each theme color, which you can then use in your components'
Pages with the
script-src CSP rule enabled may require a nonce to be specified for embedded style tags.
Modifying SASS variables
Starting with Vuetify 2.0 is built using SASS/SCSS in which you can change variables and re-compile these style files. A list of available variables is located in each components' folder. In order to build the SASS file, you will need to configure your application to support SASS. If you are using vue-cli 3 or one of the pre-made templates available on the Quick Start guide, you can skip the next section.
SCSS is used for variable files to support maps using indented syntax.
Setup sass-loader with Webpack
In the command line, run:
This will install the dependencies needed to import and parse SASS files. Once installed, open your webpack config and add a rule for SASS. For SSR based applications, ensure that the import is in your main
Create a folder called
sass in your src directory (or appropriate assets directory) with a file named
main.sass. This will serve as the entry point to import and rebuild the default Vuetify styles. Once created, open the .sass file and add this entry.
It is recommended that the import be located in your main application
client-entry.js file. DO NOT import your
main.sass inside of a component. This will cause performance issues and drastically slow down HMR (hot module reloading).
After you have decided on your import location, if you are requiring the Vuetify stylesheet by a
<link> tag in your index file, remove it. Restart your build processes and re-open your project. You should see all of the styles working correctly.
Now that SASS is configured, you can set default values for the SASS variables that you wish to change. These must be declared before the import and will automatically override the Vuetify defaults.