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

Add system-preference-based theme support #5883

Closed
wants to merge 1 commit into from

Conversation

tofarr
Copy link
Collaborator

@tofarr tofarr commented Dec 28, 2024

This PR adds support for automatically switching between light and dark themes based on the user's system preferences.

Changes:

  • Updated NextUI configuration to support both light and dark themes with appropriate colors
  • Created a new ThemeContext that:
    • Automatically detects system's color scheme preference
    • Persists theme preference in localStorage
    • Listens for system theme changes
    • Provides a way to manually switch themes
  • Updated root layout to wrap the application with ThemeProvider

The theme will now:

  • Use system's color scheme preference by default
  • Remember user's last selected theme
  • Update in real-time if system's theme preference changes
  • Apply appropriate theme classes to HTML root element

To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:96cad63-nikolaik   --name openhands-app-96cad63   docker.all-hands.dev/all-hands-ai/openhands:96cad63

@tofarr tofarr marked this pull request as draft December 28, 2024 19:12
@tofarr tofarr closed this Dec 30, 2024
@tofarr tofarr deleted the feature/theme-system-preference branch December 30, 2024 14:35
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