Expose default_color_mode in rx.Config#6716
Conversation
Greptile SummaryThis PR exposes
Confidence Score: 5/5Safe to merge — the change is additive, defaults to the existing system behavior, and the two compiler call-sites resolve the color mode from the same theme object so they cannot drift out of sync. The refactor is clean: constants are moved not duplicated, the new helper is tested with isolated mocks, and env-var validation delegates to existing Literal-aware machinery that raises on invalid input. No existing behavior is broken. No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "add news fragment" | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5a912f962
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| appearance = getattr(theme, "appearance", None) | ||
| if appearance is None or str(LiteralVar.create(appearance)) == '"inherit"': | ||
| appearance = LiteralVar.create(SYSTEM_COLOR_MODE) | ||
| appearance = LiteralVar.create(get_config().default_color_mode) |
There was a problem hiding this comment.
Propagate default color mode into the preload script
When an app sets default_color_mode="dark" or "light" and the browser has no saved theme in localStorage, this only changes the compiled context/ThemeProvider default; create_document_root still unconditionally injects preload_color_theme(), whose inline script applies localStorage.getItem("theme") || "system" before hydration. For example, a dark default on a light OS first paints light and then flips to dark after React initializes, so the new config still produces a visible FOUC/mismatched initial class unless the preload path receives the same default.
Useful? React with 👍 / 👎.
No description provided.