summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Wielicki <j.wielicki@sotecware.net>2017-11-12 17:33:58 +0100
committerJonas Wielicki <j.wielicki@sotecware.net>2017-11-12 17:33:58 +0100
commita67b1d4eb01b80fb2c25ec54ea7c6c1f0763ac23 (patch)
treef7cbbd7aea4d321b8b2a0f3cc8bbe805c20323d4
parent6f1b7eb46ea461d15d122dba8bf4a2ab50f00179 (diff)
downloadpoezio-a67b1d4eb01b80fb2c25ec54ea7c6c1f0763ac23.tar.gz
poezio-a67b1d4eb01b80fb2c25ec54ea7c6c1f0763ac23.tar.bz2
poezio-a67b1d4eb01b80fb2c25ec54ea7c6c1f0763ac23.tar.xz
poezio-a67b1d4eb01b80fb2c25ec54ea7c6c1f0763ac23.zip
Move definition of CCG_PALETTE to Theme object
-rwxr-xr-xpoezio/theming.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/poezio/theming.py b/poezio/theming.py
index 4c93d396..af1c7839 100755
--- a/poezio/theming.py
+++ b/poezio/theming.py
@@ -277,6 +277,10 @@ class Theme(object):
(212, -1), (213, -1), (214, -1), (215, -1), (216, -1), (217, -1),
(218, -1), (219, -1), (220, -1), (221, -1), (222, -1), (223, -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
@@ -517,18 +521,14 @@ def prepare_ccolor_palette(theme):
"""
Prepare the Consistent Color Generation (XEP-0392) palette for a theme.
"""
- if hasattr(theme, "CCG_PALETTE"):
- # theme overrides the palette
+ if theme.CCG_PALETTE is not None:
return
if any(bg != -1 for fg, bg in theme.LIST_COLOR_NICKNAMES):
# explicitly disable CCG, can’t handle dynamic background colors
- theme.CCG_PALETTE = None
+ theme.CCG_PALETTE = {}
return
- if not hasattr(theme, "CCG_Y"):
- theme.CCG_Y = 0.5**0.45
-
theme.CCG_PALETTE = colors.generate_ccg_palette(
[
fg for fg, _ in theme.LIST_COLOR_NICKNAMES