Skip to content

feat(ui): add solid background color option for input prompt#16563

Merged
jacob314 merged 6 commits intomainfrom
input_background
Jan 26, 2026
Merged

feat(ui): add solid background color option for input prompt#16563
jacob314 merged 6 commits intomainfrom
input_background

Conversation

@jacob314
Copy link
Copy Markdown
Contributor

@jacob314 jacob314 commented Jan 14, 2026

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:
Screenshot 2026-01-08 at 3 01 17 PM

Dark theme:
image

Dark theme mac terminal
image

Light theme mac terminal.
image
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.
Screenshot 2026-01-08 at 2 51 59 PM

@jacob314 jacob314 requested a review from a team as a code owner January 14, 2026 00:18
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Input Prompt Visual Redesign: The input prompt's default styling has been updated to remove vertical borders, opting instead for a solid background color. This provides a cleaner, more integrated look.
  • New Configuration Option: A new setting, ui.useBackgroundColor, has been introduced. This boolean option, defaulting to true, allows users to toggle between the new background color styling and the traditional border-based prompt.
  • Dynamic Color Rendering: The input prompt now intelligently adapts its background color based on the terminal's reported color depth. In low color depth environments (e.g., 256-color terminals), it uses safe grayscale colors to avoid jarring approximations when blending, ensuring a consistent visual experience.
  • Test Suite Enhancements: New tests have been added to thoroughly validate the background color styling across different terminal color depths and background color configurations. Existing mouse interaction tests were also updated to reflect the removal of vertical borders.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 14, 2026

Size Change: +15.4 kB (+0.07%)

Total Size: 23.4 MB

Filename Size Change
./bundle/gemini.js 23.4 MB +15.4 kB (+0.07%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

gemini-code-assist[bot]

This comment was marked as resolved.

@jacob314
Copy link
Copy Markdown
Contributor Author

jacob314 commented Jan 14, 2026

The dark theme ui when accepting edits is a little ugly. We might want to reconsider what background color we want for that mode. The yellow border looks a bit brown when blended.
Screenshot 2026-01-13 at 4 36 59 PM

Yolo mode by comparison looks good

image

@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Jan 14, 2026
@jacob314 jacob314 changed the title input background feat(ui): add solid background color option for input prompt Jan 14, 2026
@jacob314 jacob314 requested a review from a team as a code owner January 14, 2026 01:02
@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality and removed status/need-issue Pull requests that need to have an associated issue. labels Jan 14, 2026
@jacob314 jacob314 force-pushed the input_background branch 2 times, most recently from 2bb7750 to f57d5ad Compare January 14, 2026 01:47
@jacob314 jacob314 enabled auto-merge January 14, 2026 01:56
@jacob314
Copy link
Copy Markdown
Contributor Author

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) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline. minHeight 1 is equiv to 3 before.

) : (
<Box width={mainAreaWidth} flexDirection="row">
<Text color={terminalBg} backgroundColor={backgroundColor}>
{'▄'.repeat(mainAreaWidth)}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sehoon38 sehoon38 requested a review from a team as a code owner January 21, 2026 04:12
@jacob314 jacob314 added the 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. label Jan 22, 2026
@bdmorgan
Copy link
Copy Markdown
Collaborator

Automatically closing PR as it is older than 7 days and authored by a team member.

@bdmorgan bdmorgan closed this Jan 23, 2026
auto-merge was automatically disabled January 23, 2026 20:46

Pull request was closed

@jacob314 jacob314 reopened this Jan 26, 2026
afarber and others added 4 commits January 26, 2026 12:32
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
@jacob314 jacob314 force-pushed the input_background branch 3 times, most recently from 9fed54b to c885fdd Compare January 26, 2026 21:24
@jacob314
Copy link
Copy Markdown
Contributor Author

Changes in the updated version:
use the background color for user messages in the history. For discussion: we use the unfocused background color for them but could use the focused one if we wanted.

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.
Updated the ink version to fix a render bug exposed by rendering a full width background.

@jacob314
Copy link
Copy Markdown
Contributor Author

Example screenshot:
image

// 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(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

const isLowColor = isLowColorDepth();

const backgroundColor = useMemo(() => {
if (!useBackgroundColor) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jacob314 jacob314 enabled auto-merge January 26, 2026 23:18
@jacob314 jacob314 added this pull request to the merge queue Jan 26, 2026
Merged via the queue into main with commit b5fe372 Jan 26, 2026
24 of 25 checks passed
@jacob314 jacob314 deleted the input_background branch January 26, 2026 23:36
yunaseoul pushed a commit that referenced this pull request Jan 27, 2026
Co-authored-by: Alexander Farber <farber72@outlook.de>
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
kuishou68 pushed a commit to iOfficeAI/aioncli that referenced this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove horizontal lines on the side of the input prompt box when not in alternate buffer mode

4 participants