darcyai.config

RGB Objects

class RGB()

Class to hold the configuration for the RGB.

Arguments

  • red (int): The red value.
  • green (int): The green value.
  • blue (int): The blue value.

red

def red() -> int

Returns the red value.

Returns

int: The red value.

green

def green() -> int

Returns the green value.

Returns

int: The green value.

blue

def blue() -> int

Returns the blue value.

Returns

int: The blue value.

to_hex

def to_hex() -> str

Returns the hex value of the RGB.

Returns

str: The hex value.

from_string

@staticmethod
def from_string(rgb: str) -> "RGB"

Creates an RGB object from a comma separated RGB string.

Arguments

  • rgb (str): The comma separated RGB string.

Returns

RGB: The RGB object.

Examples

>>> RGB.from_string("255,255,255")

from_hex_string

@staticmethod
def from_hex_string(hex_rgb: str) -> "RGB"

Creates an RGB object from a hex RGB string.

Arguments

  • hex_rgb (str): The hex RGB string.

Returns

RGB: The RGB object.