feat: add custom theme support via component_config#583
feat: add custom theme support via component_config#583
Conversation
Add ThemeConfig (colorScheme, accentColor, accentHoverColor, backgroundColor, foregroundColor, oddRowBackgroundColor, borderColor) nested in ComponentConfig. Flows through existing pipeline — Python widget, server /load endpoint, and JS rendering all support theme overrides with no new traitlets or sync wiring. Resolves #582 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📦 TestPyPI package publishedpip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.12.12.dev22418216574or with uv: uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.12.12.dev22418216574MCP server for Claude Codeclaude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.12.12.dev22418216574" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0f02302e3
ℹ️ 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".
| dvc["component_config"] = { | ||
| **dvc.get("component_config", {}), | ||
| **component_config, |
There was a problem hiding this comment.
Persist component_config in buckaroo dataflow state
LoadHandler.post only overlays component_config onto session.df_display_args here, but buckaroo interactions later rebuild df_display_args from session.dataflow in DataStreamHandler._handle_buckaroo_state_change (websocket_handler.py), which never receives this config. In server mode="buckaroo", theme/custom component settings from /load are therefore lost after the first state-changing action (for example changing cleaning/post-processing), so the new feature does not persist through normal usage.
Useful? React with 👍 / 👎.
| ...hs.applicableStyle, | ||
| ...(themeConfig?.accentColor ? { '--bk-accent-color': themeConfig.accentColor } as any : {}), | ||
| ...(themeConfig?.accentHoverColor ? { '--bk-accent-hover-color': themeConfig.accentHoverColor } as any : {}), | ||
| ...(themeConfig?.backgroundColor ? { '--bk-bg-color': themeConfig.backgroundColor } as any : {}), |
There was a problem hiding this comment.
Honor forced colorScheme when backgroundColor is omitted
This style injection only sets --bk-bg-color when themeConfig.backgroundColor is provided, so a config like { colorScheme: 'dark' } leaves no background variable and .theme-hanger falls back to the OS media-query defaults in CSS. As a result, forced light/dark mode can still show the opposite wrapper/empty-grid background unless callers also set backgroundColor, which breaks the expected behavior of colorScheme override by itself.
Useful? React with 👍 / 👎.
|
@codex implement any code fixes you see necessary on this PR |
Summary
Testing
Committed on the current branch ( |
Summary
ThemeConfigtype (7 optional color/scheme properties) nested insideComponentConfig— rides the existing pipeline with no new traitlets or sync wiringresolveColorScheme()is the single source of truth for light/dark resolution — respectscolorSchemeoverride or falls back to OS detectionclassNameis now additive to the auto-detected AG Grid theme class (no longer replaces it)--bk-accent-color,--bk-accent-hover-color,--bk-bg-color) scoped per-instance via inline style on the wrapper div/loadendpoint accepts optionalcomponent_configand merges it intodf_display_argsUsage
Test plan
uv run pytest tests/unit/test_theme_config.py -v— 4 Python config flow tests passuv run pytest tests/unit/ -v— 574 existing tests pass, 0 regressionsuv run pytest tests/unit/server/ -v— 13 server tests passtsc --noEmit— only pre-existing FloatingTooltip errors)npx playwright test theme-custom— Storybook visual assertionsnpx playwright test theme-custom-server— Server integration assertionsCloses #582
🤖 Generated with Claude Code