Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
pip._vendor.rich.style.Style Class Reference
Collaboration diagram for pip._vendor.rich.style.Style:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, *Optional[Union[Color, str]] color=None, Optional[Union[Color, str]] bgcolor=None, Optional[bool] bold=None, Optional[bool] dim=None, Optional[bool] italic=None, Optional[bool] underline=None, Optional[bool] blink=None, Optional[bool] blink2=None, Optional[bool] reverse=None, Optional[bool] conceal=None, Optional[bool] strike=None, Optional[bool] underline2=None, Optional[bool] frame=None, Optional[bool] encircle=None, Optional[bool] overline=None, Optional[str] link=None, Optional[Dict[str, Any]] meta=None)
 
"Style" null (cls)
 
"Style" from_color (cls, Optional[Color] color=None, Optional[Color] bgcolor=None)
 
"Style" from_meta (cls, Optional[Dict[str, Any]] meta)
 
"Style" on (cls, Optional[Dict[str, Any]] meta=None, **Any handlers)
 
str link_id (self)
 
str __str__ (self)
 
bool __bool__ (self)
 
str normalize (cls, str style)
 
StyleType pick_first (cls, *Optional[StyleType] values)
 
Result __rich_repr__ (self)
 
bool __eq__ (self, Any other)
 
bool __ne__ (self, Any other)
 
int __hash__ (self)
 
Optional[Colorcolor (self)
 
Optional[Colorbgcolor (self)
 
Optional[str] link (self)
 
bool transparent_background (self)
 
"Style" background_style (self)
 
Dict[str, Any] meta (self)
 
"Style" without_color (self)
 
"Style" parse (cls, str style_definition)
 
str get_html_style (self, Optional[TerminalTheme] theme=None)
 
"Style" combine (cls, Iterable["Style"] styles)
 
"Style" chain (cls, *"Style" styles)
 
"Style" copy (self)
 
"Style" clear_meta_and_links (self)
 
"Style" update_link (self, Optional[str] link=None)
 
str render (self, str text="", *Optional[ColorSystem] color_system=ColorSystem.TRUECOLOR, bool legacy_windows=False)
 
None test (self, Optional[str] text=None)
 
"Style" __add__ (self, Optional["Style"] style)
 

Public Attributes

 color
 
 bgcolor
 
 link
 

Static Public Attributes

dict STYLE_ATTRIBUTES
 
 bold = _Bit(0)
 
 dim = _Bit(1)
 
 italic = _Bit(2)
 
 underline = _Bit(3)
 
 blink = _Bit(4)
 
 blink2 = _Bit(5)
 
 reverse = _Bit(6)
 
 conceal = _Bit(7)
 
 strike = _Bit(8)
 
 underline2 = _Bit(9)
 
 frame = _Bit(10)
 
 encircle = _Bit(11)
 
 overline = _Bit(12)
 

Protected Member Functions

str _make_ansi_codes (self, ColorSystem color_system)
 
"Style" _add (self, Optional["Style"] style)
 

Protected Attributes

 _color
 
 _bgcolor
 
 _set_attributes
 
 _attributes
 
 _link
 
 _meta
 
 _link_id
 
 _null
 
 _style_definition
 
 _ansi
 
 _hash
 

Static Protected Attributes

Optional _color [Color]
 
Optional _bgcolor [Color]
 
int _attributes
 
int _set_attributes
 
Optional _hash [int]
 
bool _null
 
Optional _meta [bytes]
 
dict _style_map
 

Detailed Description

A terminal style.

A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such
as bold, italic etc. The attributes have 3 states: they can either be on
(``True``), off (``False``), or not set (``None``).

Args:
    color (Union[Color, str], optional): Color of terminal text. Defaults to None.
    bgcolor (Union[Color, str], optional): Color of terminal background. Defaults to None.
    bold (bool, optional): Enable bold text. Defaults to None.
    dim (bool, optional): Enable dim text. Defaults to None.
    italic (bool, optional): Enable italic text. Defaults to None.
    underline (bool, optional): Enable underlined text. Defaults to None.
    blink (bool, optional): Enabled blinking text. Defaults to None.
    blink2 (bool, optional): Enable fast blinking text. Defaults to None.
    reverse (bool, optional): Enabled reverse text. Defaults to None.
    conceal (bool, optional): Enable concealed text. Defaults to None.
    strike (bool, optional): Enable strikethrough text. Defaults to None.
    underline2 (bool, optional): Enable doubly underlined text. Defaults to None.
    frame (bool, optional): Enable framed text. Defaults to None.
    encircle (bool, optional): Enable encircled text. Defaults to None.
    overline (bool, optional): Enable overlined text. Defaults to None.
    link (str, link): Link URL. Defaults to None.

Member Function Documentation

◆ __bool__()

bool pip._vendor.rich.style.Style.__bool__ (   self)
A Style is false if it has no attributes, colors, or links.

◆ __str__()

str pip._vendor.rich.style.Style.__str__ (   self)
Re-generate style definition from attributes.

◆ _make_ansi_codes()

str pip._vendor.rich.style.Style._make_ansi_codes (   self,
ColorSystem  color_system 
)
protected
Generate ANSI codes for this style.

Args:
    color_system (ColorSystem): Color system.

Returns:
    str: String containing codes.

◆ background_style()

"Style" pip._vendor.rich.style.Style.background_style (   self)
A Style with background only.

◆ bgcolor()

Optional[Color] pip._vendor.rich.style.Style.bgcolor (   self)
The background color or None if it is not set.

◆ chain()

"Style" pip._vendor.rich.style.Style.chain (   cls,
*"Style"  styles 
)
Combine styles from positional argument in to a single style.

Args:
    *styles (Iterable[Style]): Styles to combine.

Returns:
    Style: A new style instance.

◆ clear_meta_and_links()

"Style" pip._vendor.rich.style.Style.clear_meta_and_links (   self)
Get a copy of this style with link and meta information removed.

Returns:
    Style: New style object.

◆ color()

Optional[Color] pip._vendor.rich.style.Style.color (   self)
The foreground color or None if it is not set.

◆ combine()

"Style" pip._vendor.rich.style.Style.combine (   cls,
Iterable["Style"]  styles 
)
Combine styles and get result.

Args:
    styles (Iterable[Style]): Styles to combine.

Returns:
    Style: A new style instance.

◆ copy()

"Style" pip._vendor.rich.style.Style.copy (   self)
Get a copy of this style.

Returns:
    Style: A new Style instance with identical attributes.

◆ from_color()

"Style" pip._vendor.rich.style.Style.from_color (   cls,
Optional[Color]   color = None,
Optional[Color]   bgcolor = None 
)
Create a new style with colors and no attributes.

Returns:
    color (Optional[Color]): A (foreground) color, or None for no color. Defaults to None.
    bgcolor (Optional[Color]): A (background) color, or None for no color. Defaults to None.

◆ from_meta()

"Style" pip._vendor.rich.style.Style.from_meta (   cls,
Optional[Dict[str, Any]]  meta 
)
Create a new style with meta data.

Returns:
    meta (Optional[Dict[str, Any]]): A dictionary of meta data. Defaults to None.

◆ get_html_style()

str pip._vendor.rich.style.Style.get_html_style (   self,
Optional[TerminalTheme]   theme = None 
)
Get a CSS style rule.

◆ link()

Optional[str] pip._vendor.rich.style.Style.link (   self)
Link text, if set.

◆ link_id()

str pip._vendor.rich.style.Style.link_id (   self)
Get a link id, used in ansi code for links.

◆ meta()

Dict[str, Any] pip._vendor.rich.style.Style.meta (   self)
Get meta information (can not be changed after construction).

◆ normalize()

str pip._vendor.rich.style.Style.normalize (   cls,
str  style 
)
Normalize a style definition so that styles with the same effect have the same string
representation.

Args:
    style (str): A style definition.

Returns:
    str: Normal form of style definition.

◆ null()

"Style" pip._vendor.rich.style.Style.null (   cls)
Create an 'null' style, equivalent to Style(), but more performant.

◆ on()

"Style" pip._vendor.rich.style.Style.on (   cls,
Optional[Dict[str, Any]]   meta = None,
**Any  handlers 
)
Create a blank style with meta information.

Example:
    style = Style.on(click=self.on_click)

Args:
    meta (Optional[Dict[str, Any]], optional): An optional dict of meta information.
    **handlers (Any): Keyword arguments are translated in to handlers.

Returns:
    Style: A Style with meta information attached.

◆ parse()

"Style" pip._vendor.rich.style.Style.parse (   cls,
str  style_definition 
)
Parse a style definition.

Args:
    style_definition (str): A string containing a style.

Raises:
    errors.StyleSyntaxError: If the style definition syntax is invalid.

Returns:
    `Style`: A Style instance.

◆ pick_first()

StyleType pip._vendor.rich.style.Style.pick_first (   cls,
*Optional[StyleType]  values 
)
Pick first non-None style.

◆ render()

str pip._vendor.rich.style.Style.render (   self,
str   text = "",
*Optional[ColorSystem]   color_system = ColorSystem.TRUECOLOR,
bool   legacy_windows = False 
)
Render the ANSI codes for the style.

Args:
    text (str, optional): A string to style. Defaults to "".
    color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.

Returns:
    str: A string containing ANSI style codes.

◆ test()

None pip._vendor.rich.style.Style.test (   self,
Optional[str]   text = None 
)
Write text with style directly to terminal.

This method is for testing purposes only.

Args:
    text (Optional[str], optional): Text to style or None for style name.

◆ transparent_background()

bool pip._vendor.rich.style.Style.transparent_background (   self)
Check if the style specified a transparent background.

◆ update_link()

"Style" pip._vendor.rich.style.Style.update_link (   self,
Optional[str]   link = None 
)
Get a copy with a different value for link.

Args:
    link (str, optional): New value for link. Defaults to None.

Returns:
    Style: A new Style instance.

◆ without_color()

"Style" pip._vendor.rich.style.Style.without_color (   self)
Get a copy of the style with color removed.

Member Data Documentation

◆ _style_map

dict pip._vendor.rich.style.Style._style_map
staticprotected
Initial value:
= {
0: "1",
1: "2",
2: "3",
3: "4",
4: "5",
5: "6",
6: "7",
7: "8",
8: "9",
9: "21",
10: "51",
11: "52",
12: "53",
}

◆ STYLE_ATTRIBUTES

dict pip._vendor.rich.style.Style.STYLE_ATTRIBUTES
static
Initial value:
= {
"dim": "dim",
"d": "dim",
"bold": "bold",
"b": "bold",
"italic": "italic",
"i": "italic",
"underline": "underline",
"u": "underline",
"blink": "blink",
"blink2": "blink2",
"reverse": "reverse",
"r": "reverse",
"conceal": "conceal",
"c": "conceal",
"strike": "strike",
"s": "strike",
"underline2": "underline2",
"uu": "underline2",
"frame": "frame",
"encircle": "encircle",
"overline": "overline",
"o": "overline",
}

The documentation for this class was generated from the following file: