prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Unable to change the background color of CompletionsMenu

Open
#1,579 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In the current implementation of CompletionsMenu class, there is no option to change the style of a container. Because of this limitation, I cannot change the background color of the CompletionMenu.

Inprompt_toolkit/layout/menus.py:


class CompletionsMenu(ConditionalContainer):
    # NOTE: We use a pretty big z_index by default. Menus are supposed to be
    #       above anything else. We also want to make sure that the content is
    #       visible at the point where we draw this menu.
    def __init__(
        self,
        max_height: Optional[int] = None,
        scroll_offset: Union[int, Callable[[], int]] = 0,
        extra_filter: FilterOrBool = True,
        display_arrows: FilterOrBool = False,
        z_index: int = 10 ** 8,
    ) -> None:

I'd appreciate if someone who has run into this before and could provide a workaround for now.

Thanks!

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start in prompt_toolkit/layout/menus.py at the CompletionsMenu constructor and inspect how its container styling is currently configured. Add a way to customize the menu container so callers can change its background color, then verify that the completions menu renders with the supplied styling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.