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() → str

The hex string name.

Returns:QColor compatible hex string in format ‘#rrggbbaa’
name() → str

The hex string name. For QColor compatibility

Returns:QColor compatible hex string in format ‘#rrggbbaa’
setAlpha(a: int)

Set the alpha 8 bit value

Parameters:a (int) – 0 - 255
setRgb(r: int, g: int, b: int, a: int = 255)

Set the r, g, b and alpha 8 bit values

Parameters:
  • r – 0 - 255
  • g – 0 - 255
  • b – 0 - 255
  • a – 0 - 255
intToColorHex(color_number: int) → str

Convert an integer to a hexadecimal string compatible with QColor

Parameters:color_number – integer value of a RGB color
Returns:QColor compatible hex string in format ‘#rrggbb’