Skip to content

Conversation

@oblakeerickson
Copy link

With this change users don't have to be logged in to change the theme if they desire.

I do really like the dark theme, but now we can give anonymous users the option to choose the light theme without having to log in.

Resolves #176

With this change users don't have to be logged in to change the theme if
they desire.

I do really like the dark theme, but now we can give anonymous users the
option to choose the light theme without having to log in.

Resolves oxidecomputer#176
@vercel
Copy link

vercel bot commented Dec 10, 2025

@oblakeerickson is attempting to deploy a commit to the Oxide Computer Company Team on Vercel.

A member of the Team first needs to authorize it.

@oblakeerickson
Copy link
Author

I think for follow up we should toggle the icon too so we have a light icon and a dark icon. Instead of just using the same icon.

Also for follow up I'm making a PR for issue #172 that depends on this PR. I found that issue after making this PR.

oblakeerickson added a commit to oblakeerickson/rfd-site that referenced this pull request Dec 11, 2025
Rather than defaulting to the dark theme, let's default to the user's
system setting so that the light or dark theme is selected
automatically.

If there is no cookie present for the theme selection default to the
system theme.

If there is a cookie set use that regardless of system theme.

Regarding the code, we are using reacts `dangerouslySetInnerHTML`
property https://react.dev/reference/react-dom/components/common#dangerously-setting-the-inner-html
but we are using it in a safe way. It only interpolates `theme` which is
`'light'`, `'dark'`, or `null` - values we control from the cookie. Even
if someone tampered with the cookie, the only values that matter are
`'light'` or `'dark'`. Anything else just defaults to dark mode. So its
safe to use in this case.

Resolves oxidecomputer#172

Depends on oxidecomputer#177
@oblakeerickson
Copy link
Author

Okay I made my follow up PR: oblakeerickson#1 for #172 I made it a separate PR as to not complicate this PR as I'm still awaiting feedback. If all is well and it gets merged I'll re-point that PR to this org for feedback (the theme-toggle branch doesn't exist in the oxidecomputer rfd-site repo).

@oblakeerickson
Copy link
Author

Just pushed a follow up commit to add sun and moon icons.

CleanShot 2025-12-10 at 17 48 03

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.

No theme toggle when logged out

1 participant