Re: How to get hexadecimal colour value from Python API?



Quoting "Steffen Macke" <dia diagramr biz>:
 '#%02x%02x%02x' % (c.red*255, c.green*255, c.blue*255)

I don't think that this is too difficult. You can wrap that in a function that takes
a DiaColor object as the argument.

class DiaColor(...):
    ...
    def __hex__(self):
        return '#%02x%02x%02x' % (self.red*255, self.green*255, self.blue*255)


would allow to use
hex(my_DiaColor_object)

right?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]