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

Method from_triplet

rich/color.py:397–406  ·  view source on GitHub ↗

Create a truecolor RGB color from a triplet of values. Args: triplet (ColorTriplet): A color triplet containing red, green and blue components. Returns: Color: A new color object.

(cls, triplet: "ColorTriplet")

Source from the content-addressed store, hash-verified

395
396 @classmethod
397 def from_triplet(cls, triplet: "ColorTriplet") -> "Color":
398 """Create a truecolor RGB color from a triplet of values.
399
400 Args:
401 triplet (ColorTriplet): A color triplet containing red, green and blue components.
402
403 Returns:
404 Color: A new color object.
405 """
406 return cls(name=triplet.hex, type=ColorType.TRUECOLOR, triplet=triplet)
407
408 @classmethod
409 def from_rgb(cls, red: float, green: float, blue: float) -> "Color":

Callers 4

test_from_tripletFunction · 0.80
get_html_styleMethod · 0.80
from_rgbMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_from_tripletFunction · 0.64