def getLayer(self, layer): layerName = "BG_layer_" + str(layer) if layerName not in self.layers.keys(): newLayer = self.UFO.layers.newLayer(layerName) newLayer.color = Color("0,1,0,1") self.layers.update({layerName: newLayer}) return self.layers[layerName]
def writeMarkColors(markColors): settings = QSettings() settings.beginWriteArray("misc/markColors") # serialized in UFO form i = 0 for color, name in markColors: settings.setArrayIndex(i) settings.setValue("color", str(Color(color.getRgbF()))) settings.setValue("name", name) i += 1 settings.endArray()
def colorToQColor(color): """ Returns the QColor_ that corresponds to the defcon Color_ *color*. TODO: Color lacks online documentation. .. _Color: https://github.com/typesupply/defcon/blob/ufo3/Lib/defcon/objects/color.py .. _QColor: http://doc.qt.io/qt-5/qcolor.html """ r, g, b, a = Color(color) return QColor.fromRgbF(r, g, b, a)
def colorToQColor(color): return QColor.fromRgbF(*Color(color))