Skip to main content

Color

Functions for handling comet.CColor-objects and converting color-values of different color-models.

values_to_c_color(...)​

(values, model = comet.constants.kColorModelUnknown)​

Creates a comet-color from the given colorvalues in the given colormodel (RGB or CMYK).

Parameters:values (tuple[int|float])
For RGB: colorvalues as int 0-255
For CMYK: colorvalues as float 0.0-1.0 or int 0-100
model (comet.constants.kColorModels)
The colormodel for the given values (RGB, CMYK).
If no color model is given, the function tries to determine the desired colormodel by the amount of items in the values-tuple.
Returns:Comet-color in the specified colormodel.
Return Type:comet.CColor

values_to_c_cmyk(...)​

(values: tuple):​

Parameters:values (tuple)
CMYK-Colorvalues as float 0.0-1.0 or int 0-100
Returns:CMYK-Comet-color of the specified colorvalues.
Return Type:comet.CColor

values_to_c_rgb(...)​

(values: tuple):​

Parameters:values (tuple)
RGB-Colorvalues as int 0-255
Returns:RGB-Comet-color of the specified colorvalues.
Return Type:comet.CColor

values_cmyk_to_rgb(...)​

(values: tuple):​

Parameters:values (tuple)
CMYK-Colorvalues as float 0.0-1.0 or int 0-100
Returns:RGB-colorvalues converted from the incoming CMYK-values.
Return Type:tuple

values_rgb_to_cmyk(...)​

(values: tuple):​

Parameters:values (tuple)
RGB-Colorvalues as int 0-255
Returns:CMYK-colorvalues converted from the incoming RGB-values.
Return Type:tuple

hex_to_c_color(...)​

(hex_string: str) -> comet.CColor:​

Parameters:hex_string (str)
String of Hex-colorvalue
Returns:Hex-Comet-color of the specified colorvalues.
Return Type:comet.CColor

c_color_to_hex(...)​

(color)​

Converts a comet.CColor to its corresponding Hexcolor-value. Detects the Colortype of the given color.

Parameters:color (comet.CColor)
A comet-color with colormodel comet.constants.kColorModelGray.
Returns:String of Hexcolor
Return Type:str

c_gray_to_hex(...)​

(color)​

Converts a grayscale comet.CColor to its corresponding Hexcolor-value.

Parameters:color (comet.CColor)
A comet-color with colormodel comet.constants.kColorModelRGB.
Returns:String of Hexcolor
Return Type:str

c_rgb_to_hex(...)​

(color)​

Converts an RGB comet.CColor to its corresponding Hexcolor-value.

Parameters:color (comet.CColor)
A comet-color with colormodel comet.constants.kColorModelCMYK.
Returns:String of Hexcolor
Return Type:str

c_cmyk_to_hex(...)​

(color)​

Converts a CMYK comet.CColor to its corresponding Hexcolor-value.

Parameters:color (comet.CColor)
Returns:String of Hexcolor
Return Type:str