Re: How to get hexadecimal colour value from Python API?
- From: "W. Martin Borgert" <debacle debian org>
- To: "discussions about usage and development of dia" <dia-list gnome org>, "Steffen Macke" <dia diagramr biz>
- Subject: Re: How to get hexadecimal colour value from Python API?
- Date: Mon, 08 Jul 2013 17:29:20 +0200
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]