Debian Codegraph @

docs/features/theme.md

raw symbols SCIP
1 # Theme
2
3 `cmd2` provides the ability to configure an overall theme for your application using the
4 [cmd2.theme.update_theme][] function. This is based on the
5 [rich.theme](https://rich.readthedocs.io/en/stable/reference/theme.html) container for style
6 information. You can use this to brand your application and set an overall consistent look and feel
7 that is appealing to your user base.
8
9 ## Customizing Completion Menu Colors
10
11 `cmd2` leverages `prompt-toolkit` for its tab completion menu. You can customize the colors of the
12 completion menu by overriding the following styles in your `cmd2` theme:
13
14 - `Cmd2Style.COMPLETION_MENU` - Base style for the entire completion menu container (sets the
15 background)
16 - `Cmd2Style.COMPLETION_MENU_COMPLETION` -Style for an individual, non-selected completion item
17 - `Cmd2Style.COMPLETION_MENU_CURRENT` - Style for the currently selected completion item
18 - `Cmd2Style.COMPLETION_MENU_META` - Style for "meta" information shown alongside a completion
19 - `Cmd2Style.COMPLETION_MENU_META_CURRENT`- Style for meta info of current item
20
21 By default, the currently selected completion item and metadata are styled with black text on a
22 green background to provide contrast. All others are left at `prompt-toolkit` defaults by default.
23 However, `cmd2` application authors are free to customimze these as they see fit in order to match a
24 desired visual style and/or branding.
25
26 ## Example
27
28 See [rich_theme.py](https://github.com/python-cmd2/cmd2/blob/main/examples/rich_theme.py) for a
29 simple example of configuring a custom theme for your `cmd2` application.