Skip to content

default primaryColor : 'cyan' #101

@talhayksk

Description

@talhayksk

hen I try to set the default primaryColor in app.config.ts and also in layout.service.ts, the color behaves inconsistently.

In app.config.ts I set:
providePrimeNG({ theme: { preset: Aura, options: { primaryColor: 'cyan', darkModeSelector: '.app-dark' } } });
And in layout.service.ts I define:
_config: layoutConfig = { preset: 'Aura', primary: 'cyan', surface: null, darkTheme: false, menuMode: 'static' };
Problem

When I run the app, the primaryColor is cyan as expected.

But when I refresh the page with F5, the color first shows as emerald for a moment and then switches to cyan.

Expected Behavior

The application should load the correct default primaryColor (cyan) immediately after refresh, without flashing the fallback emerald color.

Actual Behavior

On refresh, the app temporarily shows emerald (from _config) and only afterward switches to cyan.

Steps to Reproduce

Set primaryColor in app.config.ts.

Also set a different primary value in layout.service.ts.

Run the app.

Press F5 to refresh.

Notice the flicker from emerald → cyan.

Possible Cause

It seems like the layout.service.ts config is applied first on initialization, and then the global providePrimeNG config overrides it.

Question

Is this expected behavior or a bug?
If it’s expected, what’s the correct way to safely set a global default primaryColor without this flickering issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions