nanome.util.color module¶
-
class
Color
(r=0, g=0, b=0, a=255, whole_num=None)[source]¶ Bases:
object
Represents a 32-bit color with red, green, blue and alpha channels (8 bits each).Parameters: -
classmethod
from_hex
(value)[source]¶ - Set color from hex after initializing.
Parameters: value ( str
) – Hex value of the color e.g. #ffffffff
-
classmethod
from_int
(value)[source]¶ - Set color from int after initializing.
Parameters: value ( int
) – Int value of the color
-
hex
¶ - Hex string representing the RGBA color.e.g. #ffffffff
Return type: class:str
-
rgb
¶
-
rgba
¶
-
set_color_int
(num)[source]¶ - Assigns the color an integer value representingthe red component bitshifted 24 bits, bitwise ORed withthe green component bitshifted 16 bits, bitwise ORed withthe blue component bitshifted 8 bits, ORed withthe alpha component, or more simply:r << 24 | g << 16 | b << 8 | aOR0xRRGGBBAA
Parameters: num ( int
) – Number to set the color to
-
classmethod