PaletteOptimiser

Changeset

13:f491a6576ec3
2015-09-09 Paul Boddie raw files shortlog changelog graph Changed the colourmap and added fallback matching for light and dark tones.
optimiser.py (file)
     1.1 --- a/optimiser.py	Wed Sep 09 01:52:06 2015 +0200
     1.2 +++ b/optimiser.py	Wed Sep 09 14:38:18 2015 +0200
     1.3 @@ -45,10 +45,10 @@
     1.4      "_GY", "GGC", "*CC", "CCW", # 12x
     1.5      "GGY", "GGG", "GCC", "CCW", # 13x
     1.6      "RRR", "RRM", "RMM", "MMM", # 20x
     1.7 -    "RYY", "RRW", "RMW", "MMW", # 21x
     1.8 +    "RYY", "RR*", "*MW", "MMW", # 21x
     1.9      "YYY", "YYW", "**W", "WWW", # 22x
    1.10      "YYY", "YYW", "YWW", "WWW", # 23x
    1.11 -    "RRR", "RMM", "RMM", "MMW", # 30x
    1.12 +    "RRR", "RRM", "RMM", "MMM", # 30x
    1.13      "RRY", "RRY", "RMW", "MMW", # 31x
    1.14      "YYY", "YYW", "YYW", "WWW", # 32x
    1.15      "YYY", "YYW", "YYW", "WWW", # 33x
    1.16 @@ -114,7 +114,7 @@
    1.17                      tone_map[tone] = base
    1.18                      count += freq
    1.19                  else:
    1.20 -                    base = match(light and tone[2] or tone[0], bases)
    1.21 +                    base = light and match(tone[2], bases) or match(tone[0], bases) or match(tone[2], bases)
    1.22                      if base:
    1.23                          tone_map[tone] = base
    1.24                          count += freq / 2