Created
October 6, 2024 14:08
-
-
Save lucaspmarra/8f076ceff408bc76e6775b8b752ac6a8 to your computer and use it in GitHub Desktop.
PrimeVue - change Aura preset default color and type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createApp } from "vue"; | |
| import { definePreset } from '@primevue/themes'; | |
| import PrimeVue from "primevue/config"; | |
| import Aura from "@primevue/themes/aura"; | |
| import App from "./App.vue"; | |
| // You can change the name 'purple' to any name you like, in my case it was just to keep the standard | |
| const purple = definePreset(Aura, { | |
| semantic: { | |
| primary: { | |
| 50: '{purple.50}', | |
| 100: '{purple.100}', | |
| 200: '{purple.200}', | |
| 300: '{purple.300}', | |
| 400: '{purple.400}', | |
| 500: '{purple.500}', | |
| 600: '{purple.600}', | |
| 700: '{purple.700}', | |
| 800: '{purple.800}', | |
| 900: '{purple.900}', | |
| 950: '{purple.950}' | |
| }, | |
| /* | |
| * This code snippet comes from the AppConfigurator.vue file, | |
| * from the getPresetExt function that returns this configuration, | |
| I thought it would be prudent to bring it too | |
| */ | |
| colorScheme: { | |
| light: { | |
| primary: { | |
| color: "{primary.500}", | |
| contrastColor: "#ffffff", | |
| hoverColor: "{primary.600}", | |
| activeColor: "{primary.700}", | |
| }, | |
| highlight: { | |
| background: "{primary.50}", | |
| focusBackground: "{primary.100}", | |
| color: "{primary.700}", | |
| focusColor: "{primary.800}", | |
| }, | |
| surface: { | |
| 0: '#ffffff', | |
| 50: '{slate.50}', | |
| 100: '{slate.100}', | |
| 200: '{slate.200}', | |
| 300: '{slate.300}', | |
| 400: '{slate.400}', | |
| 500: '{slate.500}', | |
| 600: '{slate.600}', | |
| 700: '{slate.700}', | |
| 800: '{slate.800}', | |
| 900: '{slate.900}', | |
| 950: '{slate.950}' | |
| } | |
| }, | |
| /* | |
| * This code snippet comes from the AppConfigurator.vue file, | |
| * from the getPresetExt function that returns this configuration, | |
| I thought it would be prudent to bring it too | |
| */ | |
| dark: { | |
| primary: { | |
| color: "{primary.400}", | |
| contrastColor: "{surface.900}", | |
| hoverColor: "{primary.300}", | |
| activeColor: "{primary.200}", | |
| }, | |
| highlight: { | |
| background: "color-mix(in srgb, {primary.400}, transparent 84%)", | |
| focusBackground: | |
| "color-mix(in srgb, {primary.400}, transparent 76%)", | |
| color: "rgba(255,255,255,.87)", | |
| focusColor: "rgba(255,255,255,.87)", | |
| }, | |
| surface: { | |
| 0: '#ffffff', | |
| 50: '{slate.50}', | |
| 100: '{slate.100}', | |
| 200: '{slate.200}', | |
| 300: '{slate.300}', | |
| 400: '{slate.400}', | |
| 500: '{slate.500}', | |
| 600: '{slate.600}', | |
| 700: '{slate.700}', | |
| 800: '{slate.800}', | |
| 900: '{slate.900}', | |
| 950: '{slate.950}' | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| const app = createApp(App); | |
| app.use(PrimeVue, { | |
| theme: { | |
| preset: purple, | |
| options: { | |
| darkModeSelector: ".app-dark", | |
| }, | |
| }, | |
| }); | |
| app.mount("#app"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment