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

Method from_rgb

rich/color.py:409–420  ·  view source on GitHub ↗

Create a truecolor from three color components in the range(0->255). Args: red (float): Red component in range 0-255. green (float): Green component in range 0-255. blue (float): Blue component in range 0-255. Returns: Color: A new co

(cls, red: float, green: float, blue: float)

Source from the content-addressed store, hash-verified

407
408 @classmethod
409 def from_rgb(cls, red: float, green: float, blue: float) -> "Color":
410 """Create a truecolor from three color components in the range(0->255).
411
412 Args:
413 red (float): Red component in range 0-255.
414 green (float): Green component in range 0-255.
415 blue (float): Blue component in range 0-255.
416
417 Returns:
418 Color: A new color object.
419 """
420 return cls.from_triplet(ColorTriplet(int(red), int(green), int(blue)))
421
422 @classmethod
423 def default(cls) -> "Color":

Callers 5

test_from_rgbFunction · 0.80
bars.pyFile · 0.80
__rich_console__Method · 0.80
__rich__Method · 0.80
__rich_console__Method · 0.80

Calls 2

ColorTripletClass · 0.85
from_tripletMethod · 0.80

Tested by 1

test_from_rgbFunction · 0.64