Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use colors in vuetify

Tags:

css

vuetify.js

I know I can import colors so I can use deep-purple lighten-4 in JS, how would I actually do that in the Vuetify theme section below? Do I need to add a Vue.use(colors) ?

import Vue from 'vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.css'
import colors from 'vuetify/es5/util/colors'

import App from './App'
import router from './router'

Vue.use(Vuetify, { theme: {
  primary: '#ee44aa',
  secondary: '#424242',
  accent: '#82B1FF',
  error: '#FF5252',
  info: '#2196F3',
  success: '#4CAF50',
  warning: '#FFC107'
}})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
like image 497
Fred Warren Avatar asked Dec 13 '17 04:12

Fred Warren


People also ask

How do I change primary colors in Vuetify?

so for example in your variables. scss you can have the following code: $material-dark: ( 'background': #464994, 'text': ( 'theme': #944646, ) ); this will rewrite the default colors for the background and text color in the dark mode.

How do you add a background color on Vuetify?

To set background color with Vuetify, we can add our own theme colors. import Vue from "vue"; import Vuetify from "vuetify/lib"; import colors from "vuetify/lib/util/colors"; const vuetify = new Vuetify({ theme: { themes: { light: { primary: colors. purple, secondary: colors. grey.

How do I change my Vuetify theme?

This can be easily changed. Simply pass a theme property to the Vuetify constructor. 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.

What CSS does Vuetify use?

Vuetify uses SASS/SCSS to craft the style and appearance of all aspects of the framework.


2 Answers

From the docs:

import Vue from 'vue'
import Vuetify from 'vuetify'
import colors from 'vuetify/es5/util/colors'

Vue.use(Vuetify, {
  theme: {
    primary: colors.blue.darken4,
    secondary: colors.amber.lighten2
  }
})

Any theme color you don't specify inside the theme object is just given its default value by Vue.

like image 131
Trevor Howell Avatar answered Oct 13 '22 20:10

Trevor Howell


just use the color="" <- then your desired color ex.

<v-btn color="success">Success</v-btn>

here is my sample pen for further more example

https://codepen.io/pen/?editors=1010

like image 33
Kent Dela Cruz Fueconcillo Avatar answered Oct 13 '22 19:10

Kent Dela Cruz Fueconcillo