“poline” is an enigmatic color palette generator, that harnesses the mystical witchcraft of polar coordinates. Its
methodology, defying conventional color science, is steeped in the esoteric knowledge of the early 20th century. This
magical technology defies explanation, drawing lines between anchors to produce visually striking and otherworldly
palettes. It is an indispensable tool for the modern generative sorcerer, and a delight for the eye.
Terminology & Working Principles
The name “Poline” represents the essence of the library – a polar line.
The combination of these two words symbolizes the process of creating a palette by drawing lines between anchor points.
This unique moniker encapsulates the heart and soul of this micro-library written in TypeScript.
In “Poline“, anchors represent the points that the lines are drawn
between.
The number of points determines the number of colors generated between
each pair of anchors. The more points, the more colors generated. The positions of these points are determined by
position functions.
Summoning
The use of “Poline” begins with the invocation of its command, which can be performed with or without arguments.
If called without, the tool will generate a mesmerizing palette featuring two randomly selected anchors.
On the other hand, one can choose to provide their own anchor points,
represented as a list of hsl values, for a more personal touch.
The power to shape and mold the colors lies in your hands.
Points
The magic of “Poline” is revealed through its technique
of drawing lines between anchor points. The richness of the palette is determined
by the number of points, with each connection producing a unique color.
As shown in the illustration, increasing the number of points will yield an even greater array of colors.
By default, four points are used, but this can easily be adjusted through the ‘numPoints’ property on your Poline
instance, as demonstrated in the code example.
The resulting palette is a product of points multiplied by the number of anchor pairs.
It can be changed after initialization by setting the numPoints property on your “Poline” instance.
Anchors
At the heart of “Poline” lies the concept of anchors, the fixed points that serve as the foundation for the creation of
color palettes. Anchors are represented as a list of hsl values, which consist of three components: hue [0…360],
saturation [0…1], and lightness [0…1].
The choice is yours, whether to provide your own anchor points during
initialization or to allow “Poline” to generate a random selection for you by omitting the ‘anchorColors’ argument. The
versatility of “Poline” extends beyond its initial setup, as you can also add anchors to your palette at any time using
the ‘addAnchor‘ method. This method accepts either a color as HSL a