cadnano.color module¶
This allows the model to have a Color
object class without
the need for PyQt5.QtGui.QColor
When running the Qt Application, QColor
will be used, otherwise an
API compatible class is used and exported as a Color
object
Currently Color
objects are unused in the model and colors are stored as
QColor compatible hex string in format ‘#rrggbbaa’, and therefore is not
exposed in the API documentation
-
class
Color
(*args)¶ Bases:
object
Overloaded constructor using *args to be compatible with
QColor
usage:
Color(r, g, b)
or:
Color('#rrggbb') for hex
-
hex
()¶ The hex string name.
Returns: str – QColor compatible hex string in format ‘#rrggbbaa’
-
name
()¶ The hex string name. For QColor compatibility
Returns: str – QColor compatible hex string in format ‘#rrggbbaa’
-
setAlpha
(a)¶ Set the alpha 8 bit value
Parameters: a (int) – 0 - 255
-
setRgb
(r, g, b, a=255)¶ Set the r, g, b and alpha 8 bit values
Parameters: - r (int) – 0 - 255
- g (int) – 0 - 255
- b (int) – 0 - 255
- a (int) – 0 - 255
-
-
intToColorHex
(color_number)¶ Convert an integer to a hexadecimal string compatible with
QColor
Parameters: color_number (int) – integer value of a RGB color Returns: str – QColor compatible hex string in format ‘#rrggbb’