[#8] Added four built-in themes with dark and light previews.#50
[#8] Added four built-in themes with dark and light previews.#50AlexSkrypnyk wants to merge 7 commits into
Conversation
📝 WalkthroughWalkthroughAdds four selectable built-in themes, centralizes mode-dependent palette styling, updates theme documentation and previews, adds a built-in theme playground, and expands tests for resolution, rendering, light/dark modes, and no-color output. ChangesBuilt-in theme system
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Form
participant ThemeManager
participant BuiltInTheme
participant Widgets
Form->>ThemeManager: resolve selected theme name
ThemeManager->>BuiltInTheme: create palette instance
BuiltInTheme->>Widgets: provide mode-dependent styles
Widgets->>Form: render themed fields
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
=======================================
Coverage 99.41% 99.42%
=======================================
Files 84 88 +4
Lines 2744 2769 +25
=======================================
+ Hits 2728 2753 +25
Misses 16 16 ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@playground/README.md`:
- Around line 144-150: Update the older dark/light command examples in the
README to use the runner’s --mode=dark and --mode=light options instead of
--theme=dark and --theme=light, keeping the documented commands consistent with
the current theme definitions.
In `@README.md`:
- Line 158: Update the theme description near “Every form is themeable” to
hyphenate “built-in” when describing the shipped themes, leaving the rest of the
wording unchanged.
In `@src/Theme/DefaultTheme.php`:
- Around line 292-304: Update the valueSgr() docblock to remove the “per mode”
wording and describe the base implementation as a constant value, while
preserving the existing SGR behavior and guidance about emphasize().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: dffab024-04e0-44ef-aabb-fc0a49938eab
⛔ Files ignored due to path filters (8)
docs/assets/theme-ember-light.svgis excluded by!**/*.svgdocs/assets/theme-ember.svgis excluded by!**/*.svgdocs/assets/theme-frost-light.svgis excluded by!**/*.svgdocs/assets/theme-frost.svgis excluded by!**/*.svgdocs/assets/theme-midnight-light.svgis excluded by!**/*.svgdocs/assets/theme-midnight.svgis excluded by!**/*.svgdocs/assets/theme-mono-light.svgis excluded by!**/*.svgdocs/assets/theme-mono.svgis excluded by!**/*.svg
📒 Files selected for processing (16)
README.mddocs/content/themes.mdxdocs/util/svg-term-render.jsdocs/util/update-assets.phpplayground/10-builtin-themes/run.phpplayground/README.mdsrc/Theme/DefaultTheme.phpsrc/Theme/EmberTheme.phpsrc/Theme/FrostTheme.phpsrc/Theme/MidnightTheme.phpsrc/Theme/MonoTheme.phpsrc/Theme/ThemeManager.phptests/phpunit/Unit/Builder/FormTest.phptests/phpunit/Unit/Testing/AllWidgetsFormTest.phptests/phpunit/Unit/Theme/BuiltinThemesTest.phptests/phpunit/Unit/Theme/ThemeManagerTest.php
This comment has been minimized.
This comment has been minimized.
|
🚀 Deployed on https://6a54d00bf86e1818cceadbd3--tui-docs.netlify.app |
|
Closes #8
Summary
Adds four curated, name-selectable built-in themes -
midnight,frost,emberandmono- alongside the existingdefaulttheme.DefaultThemegains a small palette seam of five protected SGR-role accessors that its colour-carrying appearance atoms route through, so each new theme recolours a form by overriding only those five methods; behaviour fordefaultis unchanged.ThemeManagerregisters the four new names, a new playground demo makes them explorable via--theme/--mode, and generated dark/light preview SVGs illustrate each one in the README and the themes documentation page.Changes
DefaultThemegains five protected SGR-role accessors (accentSgr(),valueSgr(),indicatorSgr(),matchSgr(),borderSgr()) that its colour-carrying appearance atoms (title(),value(),indicator(),highlight(),highlightMatch(),border(),marker(),radio(),caret()) now route through instead of each inlining its own$this->isDark ? … : …ternary; behaviour fordefaultis unchanged. Four new classes -MidnightTheme,FrostTheme,EmberThemeandMonoTheme- extendDefaultThemeand override only those five accessors to recolour every widget.ThemeManager::$registrygains the four new names (midnight,frost,ember,mono) alongsidedefault.BuiltinThemesTestcovers each theme's five palette roles per mode, the bold-on-selectedvalue()behaviour, and colour-off degradation to plain text;ThemeManagerTestandAllWidgetsFormTestgain coverage for the new names;FormTestswaps its example theme value from'dark'to'midnight'.playground/10-builtin-themes/run.phprenders one form under a chosen built-in theme via--themeand--mode;playground/6-theme-detect/run.phpnow forces the dark or light palette with--modeinstead of--theme=dark/--theme=light(which named unregistered themes and errored). Both documented inplayground/README.md.docs/util/svg-term-render.jsgains a--lightoption to render on a light surface;docs/util/update-assets.phpgains capture jobs for all four themes in both dark and light; the resulting eight SVGs are committed underdocs/assets/.README.mdgains a Themes section listing all five themes with preview images;docs/content/themes.mdxis rewritten to document the palette-seam extension pattern and clarify that dark/light is amodedisplay option, not a separate theme; the new theme names are added to the docs spellcheck dictionary.Screenshots
This PR adds dark and light preview SVGs for each of the four new themes (
docs/assets/theme-{midnight,frost,ember,mono}.svgand the matching-lightvariants), shown in the README's new Themes section and indocs/content/themes.mdx.Before / After