How to use the defcon.Color function in defcon

To help you get started, we’ve selected a few defcon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fadox / fontamental / tools / abstractor.py View on Github external
path = "../../ali-uni/build/UFO/Ali-Uni_Samik_Regular.ufo"
path = "../sources/lots.ufo"
#path = "../sources/adobe.ufo"
mFont = Font(path)
mUnicodes = mFont.unicodeData
data = mFont.getDataForSerialization()
master = Font('../sources/font.ufo')
ufo = Font()
ufo.setDataFromSerialization({'info': data['info']})
layersDict = {}
layersColors = ('','1,0,0,1', '0,1,0,1', '0,0,1,1', '0.5,0.5,0,1', '0.5,0,0.5,1', '0,0.5,0.5,1', '0.5,0.5,0.5,1', '1,0,0,1', '1,0,0,1',
'1,0,0,1')
for nl in range(1, 9):
    newLayer = ufo.layers.newLayer('background' + str(nl - 1))
    newLayer.color = Color(layersColors[nl])
    layersDict.update({'layer' + str(nl): newLayer})
ufo.newGlyph('.notdef')

for glf in RAWN2C:
    layer = 0
    glfSrc = RAWN2C[glf].split(',')
    if glf == "legLG.isol":
        m = 1
    for g in glfSrc:
        if layer == 10:
            continue
        try:
            gCode = AGL2UV[g]
            mgName = mUnicodes[gCode]
            glyph = Glyph()
            glyph.copyDataFromGlyph(mFont[mgName[0]])
github trufont / trufont / Lib / defconQt / fontView.py View on Github external
def toQColor(color):
        return QColor.fromRgbF(*Color(color))
github trufont / trufont / Lib / defconQt / fontView.py View on Github external
def writeLayerColor(self):
        widget = self.sender()
        color = widget.color()
        layer = widget.property("layer")
        if color is not None:
            color = Color(color.getRgbF())
        layer.color = color
github fadox / fontamental / Lib / fontamental / minify.py View on Github external
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]
github trufont / trufont / Lib / defconQt / fontView.py View on Github external
def writeMarkColors(self, settings=None):
        if settings is None:
            settings = QSettings()
        settings.beginWriteArray("misc/markColors")
        # serialized in UFO form
        for i in range(self.markColorWidget.topLevelItemCount()):
            settings.setArrayIndex(i)
            item = self.markColorWidget.topLevelItem(i)
            color = self.markColorWidget.itemWidget(item, 0).color()
            settings.setValue("name", item.text(1))
            settings.setValue("color", str(Color(color.getRgbF())))
        settings.endArray()
github trufont / trufont / Lib / trufont / objects / settings.py View on Github external
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()
github trufont / trufont / Lib / defconQt / fontView.py View on Github external
def writeMarkColor(self):
        color = self.markColorWidget.color()
        if color is not None:
            color = Color(color.getRgbF())
        self._glyph.markColor = color