#8228·naive-ui

Use the global primary color for all component theme defaults

Author: vonWolfehausCreated Sep 30, 2026Updated Sep 30, 2026
Labelsfeature request

Clear and concise description of the problem

When overriding Naive UI’s global common.primaryColor, not all components use the updated value. Components such as NSwitch and NSlider continue using their original default primary colors because their component-specific theme variables duplicate the default color instead of inheriting the global primary color.

This results in inconsistent theming: buttons and some other components reflect the custom primary color, while switches, sliders, and potentially other components retain Naive UI’s default colors.

Suggested solution

Use the global primary color variable as the source for component-specific defaults instead of duplicating the original primary color value.

Component theme variables should derive from common.primaryColor unless explicitly overridden. For example, switch and slider active colors should reference the global primary color variable rather than hard-coded defaults.

Alternative

No response

Additional context

This is especially noticeable when applications allow users to customize the primary color at runtime through themeOverrides. A single global primary color should consistently affect all components that use the primary color semantic, including switches, sliders, buttons, tabs, progress indicators, and related states.

Explicit component-level overrides should continue to take precedence over the global value.

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.