clap_python.style

clap_python.style contains all classes to style arg-parser stdout.

class clap_python.style.AnsiColor(value)[source]

Bases: IntEnum

Enum for ANSI color codes.

Black = 30
Blue = 34
BrightBlack = 90
BrightBlue = 94
BrightCyan = 96
BrightGreen = 92
BrightMagenta = 95
BrightRed = 91
BrightWhite = 97
BrightYellow = 93
Cyan = 36
Green = 32
Magenta = 35
Red = 31
White = 37
Yellow = 33
class clap_python.style.AnsiStyle(value)[source]

Bases: IntEnum

Enum for ANSI text styles.

Bold = 1
Dim = 2
Hidden = 8
Inverse = 7
Italic = 3
Normal = 0
Strikethrough = 9
Underline = 4
class clap_python.style.Style[source]

Bases: object

Class for managing text styles.

This class allows you to set and retrieve styles for different text elements in a terminal application. You can customize styles for usage information, headers, error messages, flags, and tips.

error(style)[source]

Sets the style for error messages.

Return type:

Style

Args:

style (TextStyle): The text style to be set for error messages.

Returns:

Style: The current Style instance for method chaining.

flags(style)[source]

Sets the style for flags.

Return type:

Style

Args:

style (TextStyle): The text style to be set for flags.

Returns:

Style: The current Style instance for method chaining.

headers(style)[source]

Sets the style for headers.

Return type:

Style

Args:

style (TextStyle): The text style to be set for headers.

Returns:

Style: The current Style instance for method chaining.

tip(style)[source]

Sets the style for tips.

Return type:

Style

Args:

style (TextStyle): The text style to be set for tips.

Returns:

Style: The current Style instance for method chaining.

usage(style)[source]

Sets the style for usage information.

Return type:

Style

Args:

style (TextStyle): The text style to be set for usage.

Returns:

Style: The current Style instance for method chaining.

value_names(style)[source]

Sets the style for flag names.

Return type:

Style

Args:

style (TextStyle): The text style to be set for flag names.

Returns:

Style: The current Style instance for method chaining.

class clap_python.style.TextStyle(color, style=AnsiStyle.Normal)[source]

Bases: object

Class representing how to format and style text.

Attributes:

color: The color of the text. style: The style of the text (default is Normal).

__eq__(other)

Return self==value.

__hash__ = None
__repr__()

Return repr(self).

color: AnsiColor
style: AnsiStyle = 0