Created
May 6, 2018 07:47
-
-
Save litnimax/5c03ef02da86f350107a8efe938c4e7e to your computer and use it in GitHub Desktop.
Color convert int to css for odoo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@api.multi | |
def _get_kanban_color(self): | |
for self in self: | |
if not self.area_color: | |
continue | |
css = self.area_color[1:] | |
r,g,b = int(css[:2], 16), int(css[2:4], 16), int(css[4:], 16) | |
RGBint = (r<<16) + (g<<8) + b | |
self.kanban_color = RGBint | |
@api.multi | |
def _set_kanban_color(self): | |
for self in self: | |
if not self.kanban_color: | |
continue | |
RGBint = self.kanban_color | |
b = RGBint & 255 | |
g = (RGBint >> 8) & 255 | |
r = (RGBint >> 16) & 255 | |
self.color = '#{}{}{}'.format(r, g, b) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment