-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat: add theme hot-reload functionality #4879
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
base: dev
Are you sure you want to change the base?
Conversation
|
Is this feature still being worked on? Hot reloading the theme would be a really nice functionality for theme switching! |
653a64b to
6216894
Compare
|
@rekram1-node would you please review this PR and let me know if you have any changes. |
| { | ||
| display: "/reload-theme", | ||
| description: "reload theme from config", | ||
| onSelect: () => command.trigger("theme.reload"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of slash command can we do command panel?
Like reload themes or something?
Also you are using a watcher is it possible to 'hot reload' them since you are filewatching?
|
/review |
|
If im not looking at something that u need, feel free to dm on discord or x I get like 200 github notifications a day so Im doing my best to go through them but stuff will always sneak through |
|
lgtm |
ddd6482 to
2c96b0c
Compare
- Add /reload-theme command for manual theme reloading - Add file watchers for config and theme file changes - Add SIGWINCH handler to re-query terminal colors on resize - Add SIGUSR1/SIGUSR2 signal handlers for external automation - Make system theme background transparent for terminal opacity - Move getTerminalBackgroundColor to theme context Fixes anomalyco#815
2c96b0c to
8723897
Compare
Summary
Adds the ability to reload themes without restarting opencode. Provides multiple reload triggers to support different workflows:
/reload-themecommandAlso makes "system" theme background transparent to support terminal opacity.
Changes
Architecture
flowchart LR subgraph Triggers A[Command] B[File change] C[Resize] D[Signal] end A & B & C & D --> E[reloadTheme] E --> F[Re-query colors] F --> G[Update store] G --> H[UI re-renders]Key Decisions
Why move
getTerminalBackgroundColorto theme.tsx?Needed by both initial detection (app.tsx) and reload (theme.tsx). Moving it eliminates duplication.
Why
fs.watch()instead of@parcel/watcher?Simpler API, no extra dependencies, sufficient for watching 2 files.
Why transparent background for "system" theme?
Allows terminal opacity/blur to show through while keeping panel/menu backgrounds solid.
Why SIGWINCH handler?
Event-driven color re-detection without polling. Only active for "system" theme.
Testing
Checklist
Fixes #815