Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

FuzzyCompleter: unreadable parts on selected row with white terminal fg

Open
#2,007 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start in src/prompt_toolkit/styles/defaults.py at the completion-menu.completion.current and fuzzymatch.outside definitions, then run the minimal reproduction in a terminal with a white foreground. Confirm the chosen style keeps the outside fuzzy-match text readable on the selected row and preserves the intended completion-menu appearance.

Written by the indexing model from the issue text.

Description

Description of the issue

In the default style, the current completion row is defined as:
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/af26eec26d4c650f7de26ae474a61b1741896c1d/src/prompt_toolkit/styles/defaults.py#L69
which sets a gray foreground and a white background, swapped by the reverse property, so it renders as white foreground on gray background.

Meanwhile, the 'outside' part of the fuzzy match (the 'completion' part) is defined as:
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/af26eec26d4c650f7de26ae474a61b1741896c1d/src/prompt_toolkit/styles/defaults.py#L77
which leaves the foreground as the default from the terminal. Since the reverse property is inherited from completion-menu.completion.current, the terminal foreground becomes the displayed background for the 'outside' segment.

So, taking the swaps into account, the foreground is white (from completion-menu.completion.current) and the background comes from the terminal foreground. This is a problem when the terminal foreground is white, because then both the foreground and background colors will be white, making the 'outside' segments unreadable.

Here's a screenshot from Ubuntu stock terminal, which has a white default foreground color:
Image

Steps to reproduce

Use this MRE in a terminal where the foreground color is white:

from prompt_toolkit import prompt
from prompt_toolkit.completion import FuzzyWordCompleter

completer = FuzzyWordCompleter(
    ["hullabaloo", "bamboozle", "mumbojumbo", "fizzbuzz", "zigzag", "flimflam"]
)

print(prompt("Pick one: ", completer=completer))
Suggested fix

completion-menu.completion.current has both foreground/background colors hardcoded, so the simplest fix could be to hardcode a suitable color in completion-menu.completion.current fuzzymatch.outside, replacing fg:default.

Example with ("completion-menu.completion.current fuzzymatch.outside", "fg:#444444"),:
Image

Edit: I don't know what the intended look was supposed to be, but considering that:

  1. terminals are usually white-on-black
  2. the 'outside' foreground color is hardcoded
  3. the only variable is the background color, which comes from the terminal's foreground color

the look might have been intended to appear lighter?

Here's a variant with ("completion-menu.completion.current fuzzymatch.outside", "fg:#dddddd bg:#666666"),:
Image
In this lighter version I adjusted both colors to improve readability.

Since I'm not familiar enough with prompt_toolkit to make a call on the intended styling though, I'd rather leave the choice to the maintainers.

Dominant language
Python
Stars
10.6k
Forks
819
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prompt-toolkit/python-prompt-toolkit

All issues in prompt-toolkit/python-prompt-toolkit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.