Skip to content

[BootstrapAdminUi] Add an auto mode to the theme switcher - #407

Merged
loic425 merged 1 commit into
Sylius:mainfrom
loic425:feat/admin-theme-auto-mode
Nov 13, 2026
Merged

loic425 merged 1 commit into
Sylius:mainfrom
loic425:feat/admin-theme-auto-mode

Conversation

@loic425

@loic425 loic425 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main
Bug fix? no
New feature? yes
BC breaks? no
License MIT

The admin theme switcher only toggles between light and dark. Once you click it, your OS preference is ignored for good, and there is no way to go back to following it.

The button now opens a dropdown with three options:

  • Light and Dark force the theme, as before.
  • Auto follows prefers-color-scheme, and updates live when the OS switches (e.g. at sunset), across open tabs too.
  • The button shows the icon of the selected mode (sun, moon or screen), and the active option is highlighted.

Auto is the default and is stored by removing the sylius-theme key, so admins who never picked a theme get the same behaviour as today, and those who did keep their choice. The toggle action is kept for templates that still use it.

Translations were added in en, fr, de, es, nl and pl. public/ assets were rebuilt with yarn build.

Light Dark
Theme switcher with Light selected Theme switcher with Dark selected
Auto (OS light) Auto (OS dark)
Theme switcher with Auto selected and a light OS Theme switcher with Auto selected and a dark OS

@loic425
loic425 force-pushed the feat/admin-theme-auto-mode branch from 60b8728 to 60b2ec5 Compare November 13, 2026 09:15
TheMilek added a commit to Sylius/Sylius that referenced this pull request Nov 13, 2026
| Q               | A
|-----------------|-----
| Branch?         | 2.4
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | port of Sylius/Stack#407
| License         | MIT

The admin theme switcher only toggles between light and dark. Once you
click it, your OS preference is ignored for good, and there is no way to
go back to following it.

The button now opens a dropdown with three options:

- **Light** and **Dark** force the theme, as before.
- **Auto** follows `prefers-color-scheme`, and updates live when the OS
switches (e.g. at sunset), across open tabs too.
- The button shows the icon of the selected mode (sun, moon or screen),
and the active option is highlighted.

Auto is the default and is stored by removing the `sylius-admin-theme`
key, so admins who never picked a theme get the same behaviour as today,
and those who did keep their choice. The `toggle` action is kept for
templates that still use it.

The new labels (`theme_auto`, `theme_dark`, `theme_light`) and the
existing `toggle_theme`, which was only in English, are translated in
all 51 admin locales.

| Light | Dark |
|-------|------|
| <img width="400" alt="Theme switcher with Light selected"
src="https://github.com/user-attachments/assets/2ed240ab-34cc-4345-a613-2d3f25c0314d"
/> | <img width="400" alt="Theme switcher with Dark selected"
src="https://github.com/user-attachments/assets/65b89f47-54c7-411c-a6e1-743e12b41b8e"
/> |

| Auto (OS light) | Auto (OS dark) |
|-----------------|----------------|
| <img width="400" alt="Theme switcher with Auto selected and a light
OS"
src="https://github.com/user-attachments/assets/d7175193-0cfb-42b3-a2fd-18799ec65378"
/> | <img width="400" alt="Theme switcher with Auto selected and a dark
OS"
src="https://github.com/user-attachments/assets/39d4551a-9f25-42bf-9b7b-d900db8b9861"
/> |
@loic425
loic425 merged commit 0358a2d into Sylius:main Nov 13, 2026
6 checks passed
@loic425
loic425 deleted the feat/admin-theme-auto-mode branch November 13, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants