Tags with color names don't work in pedigree views
Color tags work correctly in all views except in pedigree views. These views modify colors: ... context.set_source_rgba(*(self.bordercolor[:3] + (0.4,))) ... and context.set_source_rgb(*self.bgcolor[:3]) As it works everywhere except in these views, I think it is a bug even if we cannot enter color names in tags Fixes #012866
This commit is contained in:
parent
0170e2b1e6
commit
e535fcefa5
@ -549,11 +549,26 @@ def color_graph_box(alive=False, gender=Person.MALE):
|
|||||||
|
|
||||||
# color functions. For hsv and hls values, use import colorsys !
|
# color functions. For hsv and hls values, use import colorsys !
|
||||||
|
|
||||||
|
def name_to_hex(value):
|
||||||
|
"""
|
||||||
|
Convert a named color to a 6 digit hexadecimal value to rgb.
|
||||||
|
"""
|
||||||
|
if value[:1] != "#":
|
||||||
|
# We have color names like "green", "orange", "yellow",...
|
||||||
|
# We need to convert them to hex format
|
||||||
|
Color = Gdk.RGBA()
|
||||||
|
Color.parse(value)
|
||||||
|
value = "#%02x%02x%02x" % (int(Color.red * 255),
|
||||||
|
int(Color.green * 255),
|
||||||
|
int(Color.blue * 255))
|
||||||
|
return value
|
||||||
|
|
||||||
def hex_to_rgb_float(value):
|
def hex_to_rgb_float(value):
|
||||||
"""
|
"""
|
||||||
Convert a 6 or 12 digit hexademical value to rgb. Returns tuple of floats
|
Convert a 6 or 12 digit hexademical value to rgb. Returns tuple of floats
|
||||||
between 0 and 1.
|
between 0 and 1.
|
||||||
"""
|
"""
|
||||||
|
value = name_to_hex(value)
|
||||||
value = value.lstrip('#')
|
value = value.lstrip('#')
|
||||||
lenv = len(value)
|
lenv = len(value)
|
||||||
return tuple(int(value[i:i+lenv//3], 16)/16.0**(lenv//3)
|
return tuple(int(value[i:i+lenv//3], 16)/16.0**(lenv//3)
|
||||||
@ -563,6 +578,7 @@ def hex_to_rgb(value):
|
|||||||
"""
|
"""
|
||||||
Convert a 6 or 12 digit hexadecimal value to rgb. Returns tuple of integers.
|
Convert a 6 or 12 digit hexadecimal value to rgb. Returns tuple of integers.
|
||||||
"""
|
"""
|
||||||
|
value = name_to_hex(value)
|
||||||
value = value.lstrip('#')
|
value = value.lstrip('#')
|
||||||
lenv = len(value)
|
lenv = len(value)
|
||||||
return tuple(int(value[i:i+lenv//3], 16) for i in range(0, lenv, lenv//3))
|
return tuple(int(value[i:i+lenv//3], 16) for i in range(0, lenv, lenv//3))
|
||||||
|
Loading…
Reference in New Issue
Block a user