fix(ui): corrected background color check in user message components#25880
fix(ui): corrected background color check in user message components#25880
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a UI rendering inconsistency in the CLI's message components. It refines the conditional logic for applying background colors, ensuring that padding is correctly rendered, especially when the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Size Change: +275 B (0%) Total Size: 33.7 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request updates the HintMessage, UserMessage, and UserShellMessage components to ensure background colors are only applied when explicitly defined in the theme. It also adds unit tests to verify that these components correctly handle the NO_COLOR environment variable. The review feedback correctly identifies that the new tests violate the repository's testing conventions by stubbing environment variables within individual test cases instead of using beforeEach and afterEach blocks for setup and cleanup.
jacob314
left a comment
There was a problem hiding this comment.
Summary
This PR successfully fixes the UI background color logic for user messages to properly account for environments without colored backgrounds (e.g., when NO_COLOR is set). It also appropriately addresses the previous review feedback by refactoring the tests to use beforeEach and afterEach blocks for environment variable stubbing (vi.stubEnv and vi.unstubAllEnvs), perfectly aligning with the repository's testing conventions.
Findings
- Critical: None. Tests, linting, and type checks all pass locally without issues.
- Improvements: None. The test setup is clean and the component logic is sound.
- Nitpicks: None.
Conclusion
Approved. The implementation is solid and the testing hygiene is excellent. Ready to merge!

Summary
Fixed check for background color in user message components, correctly adding padding around them in the process.
Details
Fixed
packages/cli/src/ui/components/messages/HintMessage.tsxpackages/cli/src/ui/components/messages/UserMessage.tsxpackages/cli/src/ui/components/messages/UserShellMessage.tsxRelated Issues
Fixes #25879
How to Validate
Start the CLI after typing
export NO_COLOR=truein the terminal. After asking multiple commands, there should be space around the user messages in the history. Typing a shell command like! lsshould also have padding.Screenshot:

Pre-Merge Checklist