How to disable a pattern?
spiffytech opened this issue · 1 comments
How can I disable a specific pattern when using geopattern
? One of them doesn't look good in my context. I see geopattern
takes a generator
parameter, but I can't tell what I should supply there.
The generator
option lets you specify a specific pattern name from the PATTERNS
array. That overrides the value derived from the input hash. It sounds like you don't necessarily want to override it, just remove one. I suppose you could extend the generator class and override generatePattern
:
Lines 144 to 158 in 7f7fd79
It chooses the pattern index based on one of the hex digits in the hashed input. You'd run into an issue removing one of the 16 that no longer maps to a pattern. A few ideas:
- You could add logic that says "if removed, go to the next one" as long as you're okay with that pattern being twice as likely as any other.
- Replace the pattern with a new one of your own design.
- Pull from an additional hex digit and redistribute the 256 values among 15 possible patterns. Still not quite evenly divisible, but much closer than one being twice as likely.