Skip to content

Commit a12de33

Browse files
committed
fix(palette): update palettes
1 parent 84b30b4 commit a12de33

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/app/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { provideStore } from '@ngxs/store';
33

44
import { TranslateModule } from '@ngx-translate/core';
55

6-
import Aura from '@primeng/themes/aura';
76
import { ConfirmationService, MessageService } from 'primeng/api';
87
import { providePrimeNG } from 'primeng/config';
98

@@ -16,6 +15,7 @@ import { STATES } from '@core/constants';
1615
import { provideTranslation } from '@core/helpers';
1716

1817
import { GlobalErrorHandler } from './core/handlers';
18+
import CustomPreset from './core/helpers/custom-preset';
1919
import { authInterceptor, errorInterceptor } from './core/interceptors';
2020
import { routes } from './app.routes';
2121

@@ -26,7 +26,7 @@ export const appConfig: ApplicationConfig = {
2626
provideStore(STATES, withNgxsReduxDevtoolsPlugin({ disabled: false })),
2727
providePrimeNG({
2828
theme: {
29-
preset: Aura,
29+
preset: CustomPreset,
3030
options: {
3131
darkModeSelector: false,
3232
cssLayer: {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { definePreset, palette } from '@primeng/themes';
2+
import Aura from '@primeng/themes/aura';
3+
4+
const primaryPalette = palette(getCssVariableValue('--pr-blue-1'));
5+
const secondaryPalette = palette(getCssVariableValue('--bg-blue-3'));
6+
const successPalette = palette(getCssVariableValue('--green-1'));
7+
const dangerPalette = palette(getCssVariableValue('--red-1'));
8+
const infoPalette = palette(getCssVariableValue('--blue-1'));
9+
10+
const CustomPreset = definePreset(Aura, {
11+
semantic: {
12+
primary: primaryPalette,
13+
surface: secondaryPalette,
14+
red: dangerPalette,
15+
green: successPalette,
16+
sky: infoPalette,
17+
colorScheme: {
18+
light: {
19+
primary: {
20+
hoverColor: getCssVariableValue('--pr-blue-3'),
21+
},
22+
},
23+
},
24+
},
25+
});
26+
27+
function getCssVariableValue(variableName: string): string {
28+
return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim();
29+
}
30+
31+
export default CustomPreset;

src/app/core/helpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './custom-preset';
12
export * from './http.helper';
23
export * from './i18n.helper';
34
export * from './link-validator.helper';

0 commit comments

Comments
 (0)