Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify text color variants

I want to use one of the color variants for text, how can I do this? I have tried:

<h2 class="red--text lighten-1--text">My Address</h2>

<h2 class="red--text lighten-1">My Address</h2>

<h2 class="red-lighten-1--text">My Address</h2>

and many other variations, but I can only seem to get the text to go the base red color, not the variants listed here. Can anyone help?

like image 875
Brad Avatar asked Feb 12 '19 08:02

Brad


People also ask

How do I change the text color in Vuetify?

Changing text color and background color is easy with Vuetify, too. For the background color, simply add the name of the required color to the element's class. For text color, just add the color name followed by --text .

How do I add color to Vuetify?

By picking a color group (yellow, red, blue, and so on) and combining it with one of the modifying classes ( lighten-{n} , darken-{n} , accent-{n} ) you can get hundreds of colors to add to your Vue app and reflect your brand or style.

How do I change my Vuetify theme color?

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.


2 Answers

class="red--text text--lighten-5"

from the docs

Text colors also support darken and lighten variants using text--{lighten|darken}-{n}

or you can inspect elements and pick up classes from there

like image 178
fila90 Avatar answered Oct 18 '22 03:10

fila90


You must use it this way:

<h2 class="red--text text--lighten-1">My Address</h2>

For darken-{n} and lighten-{n}, pre-pend text instead of appending it.

Actually there is even an example almost as exactly as yours in the documentation:

<template>
  <div>
    Lorem ipsum dolor sit amet, <strong class="red--text text--lighten-1">inciderint</strong> definitionem est ea, explicari prodesset eam id. Mazim doctus vix an. <span class="indigo--text text--darken-2">Amet causae probatus nec ex</span>.
  </div>
</template>

Demo here:

<h2 class="red--text text--lighten-1">My Address</h2>.
<h2 class="red--text text--lighten-2"> My Address</h2>.

and result is this:

enter image description here

like image 34
Begueradj Avatar answered Oct 18 '22 04:10

Begueradj