Commit graph

18 commits

Author SHA1 Message Date
Daniel Thwaites
ba5565d698
Refactor palette generator ♻️
Simplified a lot of code which was unnecessarily generic.

Now using monads to manage the state of the random number generator
rather than passing it around by hand.

Also made some performance improvements, then increased the population
size so more combinations are tried in a similar length of time.
2023-07-08 14:28:15 +01:00
Carl Richard Theodor Schneider
c354350b9a
Fix accentDifference criterion for palette generation (#123)
The previous code to calculate the accentDifference for the fitness
considered cases where a=b, so the minimal difference was always 0.

The new code explicitly excludes the index, so a != b (except both
entries were sampled to the same color, but that is what we want to
punish here).
2023-07-07 13:55:10 +01:00
Daniel Thwaites
498ff69051
Continue running palette generator for longer 👔
Stop when there has been little improvement across the last 5
generations, rather than the last 1. This generally allows a higher
scoring solution to be reached.
2023-02-27 11:01:14 +00:00
Daniel Thwaites
e3dda4d032
Reduce memory usage of palette generator 2023-02-14 12:25:41 +00:00
Daniel Thwaites
939669577c
Remove Haddock pages from website 📝
This was more of a developer tool than part of the documentation, so it
makes sense to keep it off the main site. Also when modifying the
palette generator, the documentation on the site would become out of
sync with local changes anyway.
2023-02-13 20:09:56 +00:00
Daniel Thwaites
f78eff2236
Log fitness values 🔊 2022-07-16 00:30:00 +01:00
Daniel Thwaites
23033265c8 Encourage primary scale to be similar colours 👔 2022-07-01 14:38:10 +01:00
Daniel Thwaites
ffc2b3f447 End genetic algorithm when the fitness stops increasing
This allows us to reach an even better colour scheme rather than
stopping after a fixed number of generations.

For images which create a good colour scheme quickly, we avoid doing
unnecessary passes which don't lead to much improvement.
2022-07-01 12:54:44 +01:00
Daniel Thwaites
6a706cba69 Add polarity option 2022-06-30 18:17:44 +01:00
Daniel Thwaites
671068f7f6
Add internal docs for palette generator 💡
So that I don't forget how it works :)
2022-05-02 01:12:27 +01:00
Daniel Thwaites
c2358177dc
Use an external library for base16 ♻️
https://github.com/SenchoPens/base16.nix
2022-04-23 10:36:20 +01:00
Daniel Thwaites
3bde229fca
Allow generation of light schemes 2021-12-24 16:42:44 +00:00
Daniel Thwaites
09892b21a5
Use a genetic algorithm to choose colours
This produces much more visually pleasing palettes compared to the crude
algorithm which was previously used.
2021-12-16 20:03:07 +00:00
Daniel Thwaites
238366d8e0
Rename Haskell files 🚚 2021-10-18 16:40:18 +01:00
Daniel Thwaites
8ef21bcd10
Move Bucket code to a separate file ♻️ 2021-10-18 16:23:48 +01:00
Daniel Thwaites
92f63a54ff
Order base08 to base0F by hue 2021-10-17 19:48:03 +01:00
Daniel Thwaites
6c806290e4
Select colours more efficiently 2021-10-17 19:28:22 +01:00
Daniel Thwaites
7b34be82ff
Rewrite palette generation in Haskell
This does not rely on an external library for colour selection,
therefore it can be fine-tuned to create a better theme.

Closes #2 because Colorgram is no longer used.
2021-10-17 15:04:19 +01:00