Skip to content

Hide the appearance switcher, but still honor the user’s preferred color scheme #3946

Closed
@mbostock

Description

@mbostock

Is your feature request related to a problem? Please describe.

I would like to hide the appearance switcher (the dark/light mode toggle); however, I would still like VitePress to respect the user’s preferred color scheme. None of the existing appearance settings appear to allow this: enabling responsive light/mark mode also enables the appearance switcher.

Apple’s human interface guidelines expressly discourage in-app appearance switchers, saying:

Avoid offering an app-specific appearance setting. An app-specific appearance mode option creates more work for people because they have to adjust more than one setting to get the appearance they want. Worse, they may think your app is broken because it doesn’t respond to their systemwide appearance choice.

Describe the solution you'd like

Maybe setting appearance: "auto" (ideally the default) would set the dark/light mode based on the user’s preferred color scheme but without rendering the appearance switcher anywhere.

Describe alternatives you've considered

I can suppress the appearance switcher with custom CSS, but it is brittle (particularly in .VPMenu) and likely to break in future releases of VitePress:

.VPNavBarAppearance,
.VPNavScreenAppearance,
.VPMenu > .group:first-child {
  display: none !important;
}

.VPMenu > .group:nth-child(2) {
  margin-top: -13px;
}

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions