feat(ui): add solid background color option for input prompt#16563
feat(ui): add solid background color option for input prompt#16563
Conversation
Summary of ChangesHello @jacob314, 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 significantly refines the visual presentation of the input prompt by transitioning from a bordered design to a solid background color. This change enhances the user interface's modern aesthetic and introduces a new configuration option for user preference. The implementation includes robust logic to ensure visual consistency across various terminal environments, particularly concerning color depth capabilities. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Size Change: +15.4 kB (+0.07%) Total Size: 23.4 MB
ℹ️ View Unchanged
|
2bb7750 to
f57d5ad
Compare
|
Based on feedback from @jackwotherspoon changed the opacity to 8% from the 15% shown in screenshots |
| // Interpolated background colors often look bad in 256-color terminals | ||
| // because the limited color palette can't represent the subtle blend, | ||
| // leading to jarring approximations. | ||
| if (isLowColorDepth) { |
There was a problem hiding this comment.
If isLowColorDepth is true and terminalBg is a non-extreme color (neither black nor white), backgroundColor becomes undefined. In this state, the horizontal padding is lost because paddingX on the outer box depends on !isLowColorDepth.
Suggested Fix: Update the outer box paddingX to paddingX={!backgroundColor ? 1 : 0} to ensure breathing room even in low-color fallback modes.
| ) : ( | ||
| <Box width={mainAreaWidth} flexDirection="row"> | ||
| <Text backgroundColor={backgroundColor} color={terminalBg}> | ||
| {'▀'.repeat(mainAreaWidth)} |
There was a problem hiding this comment.
The use of {'▀'.repeat(mainAreaWidth)} and {'▄'.repeat(mainAreaWidth)} is susceptible to RangeError crashes if mainAreaWidth becomes negative (e.g., during rapid window resizing or specific TTY initialization states).
Suggested Fix: Use Math.max(0, mainAreaWidth) to ensure the repeat count is always a valid non-negative integer.
| alignItems="flex-start" | ||
| minHeight={3} | ||
| alignItems="stretch" | ||
| minHeight={1} |
There was a problem hiding this comment.
nit: The reduction of minHeight from 3 to 1 might make the prompt feel vertically cramped in solid background mode. Consider a minHeight of 2 or adding paddingY to the inner container to maintain the "weight" of the input area.
There was a problem hiding this comment.
discussed offline. minHeight 1 is equiv to 3 before.
| ) : ( | ||
| <Box width={mainAreaWidth} flexDirection="row"> | ||
| <Text color={terminalBg} backgroundColor={backgroundColor}> | ||
| {'▄'.repeat(mainAreaWidth)} |
There was a problem hiding this comment.
Nit: The rendering logic for the top ("▀") and bottom ("▄") caps is highly repetitive. Consider extracting a small helper function or component (e.g., PromptCap) to handle the conditional rendering between border-boxes and solid-background bars.
|
Automatically closing PR as it is older than 7 days and authored by a team member. |
Checkpoint showing a solid background color. Input prompt with background color. eckpoint fix: restore accidentally deleted code in InputPrompt.tsx Remove vertical borders from the input prompt switching to a solid background color for the input prompt by default instead of a border. refactor(ui): cleanup unused props and utilities in InputPrompt
9fed54b to
c885fdd
Compare
Fix tests and merge conflicts.
c885fdd to
3f47d61
Compare
|
Changes in the updated version: Tweak so we use the same background color regardless of mode. The background color from the shell and yolo modes was distracting and not needed. |
| // We should fallback to lines if the background color is disabled OR if it is | ||
| // enabled but we are in a low color depth terminal where we don't have a safe | ||
| // background color to use. | ||
| const useLineFallback = useMemo(() => { |
There was a problem hiding this comment.
The logic for determining "safe" low-color backgrounds in useLineFallback is duplicated from the logic inside HalfLinePaddedBox. Consider extracting this terminal capability check (detecting if a "safe" background color can be rendered in low-color mode) into a shared utility or making HalfLinePaddedBox responsible for communicating its rendering state to the parent.
| const isLowColor = isLowColorDepth(); | ||
|
|
||
| const backgroundColor = useMemo(() => { | ||
| if (!useBackgroundColor) { |
There was a problem hiding this comment.
The component defaults useBackgroundColor to true, but then checks it inside useMemo. It might be cleaner to handle the !useBackgroundColor case at the top of the component to avoid unnecessary hook execution or just return children early.
There was a problem hiding this comment.
good idea. cleaned up.
|
|
||
| // We should fallback to lines if the background color is disabled OR if it is | ||
| // enabled but we are in a low color depth terminal where we don't have a safe | ||
| // background color to use. |
There was a problem hiding this comment.
InputPrompt uses useLineFallback to render horizontal lines when the background cannot be safely rendered, but UserMessage and UserShellMessage do not have a similar line-based fallback. This creates a slight visual inconsistency in low-color terminals where the prompt has lines but history items have nothing.
There was a problem hiding this comment.
I don't think we should fallback for the user messages. showing the horizontal lines around them would be pretty annoying but if you can think of anything that would be good I'm all ears.
Co-authored-by: Alexander Farber <farber72@outlook.de>
…gemini#16563) Co-authored-by: Alexander Farber <farber72@outlook.de>
…gemini#16563) Co-authored-by: Alexander Farber <farber72@outlook.de>



Remove vertical borders from the input prompt switching to a solid background color for the input prompt by default instead of a border.
Summary
Having vertical borders on the side of the input prompt bade copy and paste needlessly frustrating with extra ascii art ending up in the paste buffer
Details
This required a bunch of IE6 era hackery to make it work well enough on key terminals we care about. In particular the default Mac terminal is a pain because it is 256 colors and has too much padding between lines. The windows terminal by comparison works great for this.
We are clever and make it look like there is half a line of padding before and after the input prompt to make it look better than cases where a full line of padding is used which looks visually excessive
Related Issues
Fixes #14385
How to Validate
Test in iterm2, ghostty, and the default mac terminal.
Test on the windows terminal
Test on a linux terminal
Test with both a light theme, dark theme, and custom theme
The default mac terminal is unfortunately 256 colors which will exercise the escape hatch mode where we use a grey background color to avoid visually distracting backgrounds when mapping themes to 256 colors.
Screenshots:

Light theme:
Dark theme:

Dark theme mac terminal

Light theme mac terminal.

Note there are a couple extra lines due to the mac terminals line spacing issues. We chose the right unicode characters so that at least there are extra lines outside the buffer rather than inside. In dark mode, the extra lines are barely noticeable in the mac terminal.
Blue background mac terminal.

Here we intentionally fall back to using lines instead of a background color as we can't safely set a background due to only 256 colors.