diff --git a/docs/nuxt-client/7_Colors.md b/docs/nuxt-client/7_Colors.md index d9742ed..fb200b0 100644 --- a/docs/nuxt-client/7_Colors.md +++ b/docs/nuxt-client/7_Colors.md @@ -4,61 +4,72 @@ sidebar_position: 8 # Colors -You can find our custom defined theme colors under `/src/themes/base-vuetify.options.js` and their overwrites per theme in `/src/themes//vuetify.options.js`. +You can find our custom defined theme colors under `/src/themes/base-vuetify.options.ts` and their overwrites per theme in `/src/themes//vuetify.options.ts`. -The colors vuetify provides you can find [here](https://v2.vuetifyjs.com/en/styles/colors/) +The colors Vuetify provides you can find [here](https://vuetifyjs.com/en/styles/colors/#colors) ## Usage ### Color Classes -All colors defined by vuetify or in our vuetify options generate css classes you can use. To aplly a color variant like lighten1, add a second class like "grey lighten-1". +All colors defined by Vuetify or in our Vuetify options generate CSS classes you can use. To apply a color variant like `lighten-1`, add it to the color like `grey-lighten-1`. +Backgrounds have the `bg-`prefix and texts the `text-`prefix. #### Examples -Using a color from vuetify's color palette: +Using a color from Vuetify's color palette: -```HTML -
+```html +
Blue background
``` Using a color defined in our vuetify options as text color: -```HTML -

- Blue background +```html +

+ Text has a red color

``` -To use a variant of a color, you have to add a second class with the name of the variant: +To use a variant of a color, you have to add the name of the variant seperated by hyphens: -```HTML -

- Blue background +```html +

+ Text has a darken variant of the red color

``` ### Use Colors in (S)CSS -For colors defined in our vuetify options, vuetify generates css variables. +For colors defined in our Vuetify options, Vuetify generates CSS variables. +Now, custom properties are an rgb list, so we need to use `rgba()` to access them. #### Examples -```SCSS +```scss .alert { - background-color: var(--v-secondary-darken1); - color: var(--v-white-base); + background-color: rgba(var(--v-theme-primary-lighten-1)); + color: rgba(var(--v-theme-primary)); +} +``` + +In Vuetify 2, we could only use hex values without the alpha property. +With Vuetify 3, it's now possible: + +```scss +.example{ + background-color: rgba(var(--v-theme-primary), 0.12); } ``` -Colors from vuetify's colors palette (as of now) do not get generated css variables. You will need to access them with map-get. +Colors from Vuetify's colors palette (as of now) do not get generated as CSS variables. You will need to access them with `map-get`. -```SCSS +```scss .alert { - background-color: color: map-get($grey, base);; - color: color: map-get($blue, lighten-3);; + background-color: map-get($grey, base); + color: map-get($blue, lighten-3); } ``` @@ -66,22 +77,20 @@ Colors from vuetify's colors palette (as of now) do not get generated css variab You can define more custom colors in our vuetify options like this: -```JS +```typescript ... -"icon-btn": { - base: colors.grey.darken3, -}, -"beta-task": { - base: "#196C9E", -}, +colors: { + info: "#0a7ac9", + "icon-btn": colors.grey.darken3, + "on-surface": "#0f3551", +} ... ``` -As of now you can only use hex values without the alpha property. If a color is only meant for one theme only, please define the color in the relating theme file for our vuetify options. - ### Rules +- talk to UX before introducing a new color - Do not overwrite vuetify colors - Use a semantic name to represent the use case -- Prefer usage via map-get over new color definition, unless you introduce a new color -- Either define style in template or in scss +- Prefer usage via `map-get` over new color definition, unless you introduce a new color +- Either define style in template or in SCSS