Source code for prettypython.text.warning

"""Format a warning message.

The default foreground color is yellow, and bold styling is enabled
by default. Additional text styles can be configured with keyword
arguments.

Args:
    text: The string to format.
    **kwargs: Optional styling settings supported by the shared
        styling engine, including ``bold``, ``underline``, ``italic``,
        ``dim``, ``reverse``, ``strikethrough``, ``color``, ``bg``,
        and ``pure``. Unknown keyword arguments are ignored.

Returns:
    str: The formatted string with ANSI escape sequences, or the
        original string when ``pure=True``.

Raises:
    TypeError: If ``text`` is not a string, or if ``color`` or ``bg``
        has an invalid type.
    ValueError: If a supplied foreground or background color name
        is unsupported.

Example:
    >>> from prettypython.text import warning
    >>> warning("Example", pure=True)
    'Example'
"""

from ._style import style


[docs] def warning(text: str, **kwargs: object) -> str: """Format text using the default yellow foreground.""" return style(text, "33", **kwargs)