Move definition of CCG_PALETTE to Theme object
This commit is contained in:
parent
6f1b7eb46e
commit
a67b1d4eb0
1 changed files with 6 additions and 6 deletions
|
@ -277,6 +277,10 @@ class Theme(object):
|
||||||
(212, -1), (213, -1), (214, -1), (215, -1), (216, -1), (217, -1),
|
(212, -1), (213, -1), (214, -1), (215, -1), (216, -1), (217, -1),
|
||||||
(218, -1), (219, -1), (220, -1), (221, -1), (222, -1), (223, -1),
|
(218, -1), (219, -1), (220, -1), (221, -1), (222, -1), (223, -1),
|
||||||
(224, -1), (225, -1), (226, -1), (227, -1)]
|
(224, -1), (225, -1), (226, -1), (227, -1)]
|
||||||
|
# XEP-0392 consistent color generation palette placeholder
|
||||||
|
# it’s generated on first use when accessing the ccg_palette property
|
||||||
|
CCG_PALETTE = None
|
||||||
|
CCG_Y = 0.5**0.45
|
||||||
|
|
||||||
# yapf: enable
|
# yapf: enable
|
||||||
|
|
||||||
|
@ -517,18 +521,14 @@ def prepare_ccolor_palette(theme):
|
||||||
"""
|
"""
|
||||||
Prepare the Consistent Color Generation (XEP-0392) palette for a theme.
|
Prepare the Consistent Color Generation (XEP-0392) palette for a theme.
|
||||||
"""
|
"""
|
||||||
if hasattr(theme, "CCG_PALETTE"):
|
if theme.CCG_PALETTE is not None:
|
||||||
# theme overrides the palette
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if any(bg != -1 for fg, bg in theme.LIST_COLOR_NICKNAMES):
|
if any(bg != -1 for fg, bg in theme.LIST_COLOR_NICKNAMES):
|
||||||
# explicitly disable CCG, can’t handle dynamic background colors
|
# explicitly disable CCG, can’t handle dynamic background colors
|
||||||
theme.CCG_PALETTE = None
|
theme.CCG_PALETTE = {}
|
||||||
return
|
return
|
||||||
|
|
||||||
if not hasattr(theme, "CCG_Y"):
|
|
||||||
theme.CCG_Y = 0.5**0.45
|
|
||||||
|
|
||||||
theme.CCG_PALETTE = colors.generate_ccg_palette(
|
theme.CCG_PALETTE = colors.generate_ccg_palette(
|
||||||
[
|
[
|
||||||
fg for fg, _ in theme.LIST_COLOR_NICKNAMES
|
fg for fg, _ in theme.LIST_COLOR_NICKNAMES
|
||||||
|
|
Loading…
Reference in a new issue