MCPcopy
hub / github.com/Textualize/rich / from_color

Method from_color

rich/style.py:213–234  ·  view source on GitHub ↗

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.

(
        cls, color: Optional[Color] = None, bgcolor: Optional[Color] = None
    )

Source from the content-addressed store, hash-verified

211
212 @classmethod
213 def from_color(
214 cls, color: Optional[Color] = None, bgcolor: Optional[Color] = None
215 ) -> "Style":
216 """Create a new style with colors and no attributes.
217
218 Returns:
219 color (Optional[Color]): A (foreground) color, or None for no color. Defaults to None.
220 bgcolor (Optional[Color]): A (background) color, or None for no color. Defaults to None.
221 """
222 style: Style = cls.__new__(Style)
223 style._ansi = None
224 style._style_definition = None
225 style._color = color
226 style._bgcolor = bgcolor
227 style._set_attributes = 0
228 style._attributes = 0
229 style._link = None
230 style._link_id = ""
231 style._meta = None
232 style._null = not (color or bgcolor)
233 style._hash = None
234 return style
235
236 @classmethod
237 def from_meta(cls, meta: Optional[Dict[str, Any]]) -> "Style":

Callers 1

decode_lineMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected