Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Option to use system preference for light/dark theme #18190

Open
1 task done
JoshuaKGoldberg opened this issue Mar 11, 2024 · 6 comments
Open
1 task done

Docs: Option to use system preference for light/dark theme #18190

JoshuaKGoldberg opened this issue Mar 11, 2024 · 6 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation

Comments

@JoshuaKGoldberg
Copy link
Contributor

Docs page(s)

all of them

What documentation issue do you want to solve?

The ESLint docs currently default to the browser's prefers-color-scheme setting for light/dark mode by default. And they have a Light/Dark selector to let the user specify an override.

But, there's no way to remove the override: i.e. go back to the default behavior of using the browser/system preference. This feels like a bug / missing feature to me: what if the user wants go back to the system preference?

I've hit this where I've needed to change the page temporarily, but subsequently wanted to go back to synced with the browser/system preferences.

What do you think is the correct solution?

A few UI options come to mind, in order of what I think is most intuitive & usable first:

  • Adding a third button like System to the existing Light/Dark selector
  • Adding a dismiss/x button to clear the current state
  • Have pressing the button again dismiss the current state

The current selector, for reference: Screenshot of the ESLint docs Light/Dark buttons, with light mode selected

Participation

  • I am willing to submit a pull request for this change.

Additional comments

Sibling issue to #18189.

@kecrily
Copy link
Member

kecrily commented Mar 11, 2024

I like the third button. It does seem more common too.

@Rec0iL99
Copy link
Member

ping @eslint/eslint-team

@Tanujkanti4441
Copy link
Contributor

i think we can just click on the light/dark button to match it with the system preference.

@nzakas
Copy link
Member

nzakas commented Mar 19, 2024

I'd like to see some examples of how other sites are doing this before coming to a conclusion here. @JoshuaKGoldberg can you compile a few sites that have implemented something along the lines of what you're describing so we can evaluate?

@JoshuaKGoldberg
Copy link
Contributor Author

A few popular sites that have options on all pages, rather than in profile settings...

Site Style Visual
Astro Dropdown Screenshot of Astro's Auto button with a computer glyph. Screenshot of Astro's unstyled browser select: Dark, Light, Auto
MDN Dropdown Screenshot of MDN's Theme dropdown. Options: (half circle) OS Default, (sun glyph) Light, (crescent moon glyph) Dark
Netlify Dropdown Screenshot of Netlify's System button with a half-filled circle glyph. Screenshot of Netlify's unstyled browser select: System, Light, Dark
Next.js Buttons Screenshot of Next.js's moon, sun, and computer buttons.
Solid (Beta) Dropdown Screenshot of Solid's (sun glyph) Light, (crescent moon glyph) Dark, and (computer glyph) System buttons in a dropdown below a sun glyph button.
TypeScript Dropdown Screenshot of TypeScript's 'Site Colours:' label and 'System' dropdown button. Screenshot of TypeScript's unstyled browser select: System, Always Light, Always Dark
Vercel Buttons Screenshot of Vercel's moon, sun, and computer buttons under a 'Preferences' label.

@nzakas
Copy link
Member

nzakas commented Mar 28, 2024

Nice, thanks! Given those, I think adding a third button with a monitor that says "System" probably makes the most sense for us.

I'm also not opposed to making the "Light", "Dark", and "System" as aria-labels that are visually hidden to save space.

@amareshsm amareshsm added the accepted There is consensus among the team that this change meets the criteria for inclusion label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation
Projects
Status: Ready to Implement
Development

No branches or pull requests

6 participants