@MoInMaRvZ answered this here
We can simply add the code directly in the app.module.ts file. Like this:
providers:
[
provideHttpClient(withInterceptorsFromDi()),
provideAnimationsAsync(),
providePrimeNG({
theme: {
preset: Lara,
options: {
darkModeSelector: '.darkmode',
},
},
}),
]