Releases: mikaello/rescript-tinycolor
v5.0.0
Changes
Rewriting all code from Bucklescript to Rescript
Breaking changes
The functions
- analogous
- monochromatic
- polyad
... did previously have data last, but now have data first (previously |>, now ->). All parameters except t are optional, but does now require a unit (()) since we are doing data first.
In code:
// Previously
TinyColor.random() |> TinyColor.analogous(~slices=10)
TinyColor.random() |> TinyColor.polyad
// Now
TinyColor.random()->TinyColor.analogous(~slices=10, ())
TinyColor.random()->TinyColor.polyad()v4.0.0
Renamed the repository to rescript-tinycolor from bs-tinycolor to adhere to the standard described in the ReScript forum: https://forum.rescript-lang.org/t/ann-rescript-package-index-release/801
The breaking changes:
- Package name is now
rescript-tinycolor(instead ofbs-tinycolor- Remember to update both
package.jsonandbsconfig.json
- Remember to update both
- In the code you need to access module
RescriptTinycolorinstead ofBsTinycolor:- open BsTinycolor + open RescriptTinycolor
v3.2.0
Updated to @ctrl/tinycolor v3.3.1, which includes the new method onBackground:
(onBackground) Compute how the color would appear on a background. When the color is fully transparent (i.e.
getAlpha() == 0), the result will be the background color. When the color is not transparent at all (i.e.getAlpha() == 1), the result will be the color itself. Otherwise you will get a computed result.
Example from tests:
let blue = TinyColor.makeFromString("blue");
let red = TinyColor.makeFromString("red");
switch (blue, red) {
| (Some(blue), Some(red)) =>
let bluePartlyTransparent = TinyColor.setAlpha(0.5, blue);
expect(
TinyColor.onBackground(bluePartlyTransparent, red) |> TinyColor.toHexString,
) == "#800080";
| _ => expect(true) == false
}v3.1.2
v3.1.1
v3.1.0
v2.0.2
Enhanced functions that have config objects
This release has better handling of configs for a handful of bindings, using optional parameters instead of makeSomeConfig(...) and using polymorphic variants for enums.
New features
Config options is now available for random(). To get multiple random colors the new function randomMultiple() can be used (and then the labeled count parameter must be provided). This is in par with the BuckleScript-bindings for randomColor (the original randomColor lib has the same implementation as tinyColors random-implementation).
Breaking changes
-
mostReadable, the parameterssizeandlevelare now polymporphic variants:TinyColor.mostReadable( ~includeFallbackColors=true, ~level=`AAA, /* Before this was "AAA" / "AA" */ ~size=`small, /* Before this was "small" / "large" */ [|comp1, comp2|], color, )
-
isReadable, the parameterssizeandlevelare now polymporphic variants:TinyColor.isReadable( ~level=`AAA, /* Before this was "AAA" / "AA" */ ~size=`small, /* Before this was "small" / "large" */ color1, color2, )
-
isReadableOptionis removed in favor of options toisReadable.
v1.0.0
All functions in original library have bindings.