Config to enable/disable theming #949
Replies: 9 comments 6 replies
-
I’m pretty strongly in favour of letting site users pick dark/light mode — forcing someone to use colours different from their preference is an accessibility concern. If people want it enough, I think we could make the default theme configurable though — i.e. |
Beta Was this translation helpful? Give feedback.
-
Love that suggested key name ;) Get what you're saying around accessibility (and even my personal experience with being blinded by the light[-theme]). Maybe a config option could be: |
Beta Was this translation helpful? Give feedback.
-
Yeah! I might suggest |
Beta Was this translation helpful? Give feedback.
-
Personally, I would prefer sites have 'auto' theme be the default, as it allows me to set my light/dark preference once (at the device level) and have my web browsing experience consistently match my preference. |
Beta Was this translation helpful? Give feedback.
-
Yeah, absolutely, we won’t change that default. |
Beta Was this translation helpful? Give feedback.
-
I also would like to be able to disable the light/dark mode switch to control better the branding of my documentation. In my case, I would like to have a dark-only mode for the website hosting the documentation and even if I style in the same way the light/dark mode, the switch will appear making the site look like if the light mode is not working. I agree that the default should still be keeping the switch and default to auto, but having a one-style is an use-case that I can see as valuable in case that somebody needs it. |
Beta Was this translation helpful? Give feedback.
-
Our Astro site doesn't have a dark mode, and we'd like to document it in starlight. But the theme toggle prevents us from deploying the documentation to a public site. Not all design systems/brandings have taken dark/light mode into account(yet) and forcing this in starlight is not productive it think. I agree it should be enabled by default, but a configuration option would be very nice. |
Beta Was this translation helpful? Give feedback.
-
Hi, is possible to know when this feature will be ready? |
Beta Was this translation helpful? Give feedback.
-
Just to make it super clear on how to follow the instructions above to force exactly dark or only light mode without any user choice:
Set file contents of
Set files contents of
Update your
On a personal note, I think it's a fair request to ask for a way to enforce that only one theme is available (choosen by the designer/developer). People never use a product in the way that the original developers intended. As people force hacks like the above, I fear (without knowing) that bundle sizes, css sizes, etc won't be optimized because they won't know to cut out the unused theme. Worse, in some future version of astro/starlight, this hack may just break. Accessibility is important. But likewise, sometimes a design or resources simply calls for only a certain color scheme to exist. It is, IMHO, worse for a user to be broken/unreadable/confused because they picked light mode on their device when the developers only implemented a dark screen option- they have no indication why the site is even broken or unreadable. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlight
are you using?0.5.6
What is your idea?
A way to set the Starlight site to only be dark or light (or auto) via the config
Why is this feature necessary?
Sometimes branding only has light or dark mode colors (or a developer only wants a specific theme). This would expose an option in the Starlight config for a user to only create a dark or light website. This could disable the theme dropdown in the navbar as well as reduce the resulting CSS.
A use case from Discord: https://discord.com/channels/830184174198718474/1070481941863878697/1125991126885744723
Do you have examples of this feature in other projects?
Docusaurus theme config for color: https://docusaurus.io/docs/api/themes/configuration#color-mode---dark-mode
I like how they also let the developer set a "preferred" mode (
defaultMode
) so that the dev could specify a specific theme but then the user could also override it if they'd like. I remember some conversations over there around all the different permutations and states this could result in so it would probably be good to have a solid think through what the API and UX would be around this.Participation
Beta Was this translation helpful? Give feedback.
All reactions