Skip to content

Releases: mikaello/rescript-tinycolor

v5.0.0

22 Jun 20:21
Compare
Choose a tag to compare

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

02 Jan 08:55
Compare
Choose a tag to compare

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 of bs-tinycolor
    • Remember to update both package.json and bsconfig.json
  • In the code you need to access module RescriptTinycolor instead of BsTinycolor:
    - open BsTinycolor
    + open RescriptTinycolor

v3.2.0

01 Jan 17:29
Compare
Choose a tag to compare

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

07 Sep 14:04
Compare
Choose a tag to compare
  • Fix typings for option seed in TinyColor.random, which was previously string, and is now changed to int: #14 , thanks @Discordius !

v3.1.1

30 Jul 09:58
Compare
Choose a tag to compare

Upgrade dependencies (security patches).

v3.1.0

05 May 17:02
Compare
Choose a tag to compare

Breaking

  • Requires Node > 10.19.0

Features

  • toNumber function
  • makeFromNumber function

Patch

Upgrades of dependencies

v2.0.2

14 Mar 08:00
Compare
Choose a tag to compare
  • Upgrade tinycolor (which this is bindings for), only bug fixes (2.5.2 -> 2.6.1)
  • Upgrade dev dependencies: bs-jest and bs-platform

Enhanced functions that have config objects

08 Jul 07:19
35aa82a
Compare
Choose a tag to compare

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 parameters size and level are 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 parameters size and level are now polymporphic variants:

    TinyColor.isReadable(
          ~level=`AAA, /* Before this was "AAA" / "AA" */
          ~size=`small, /* Before this was "small" / "large" */
          color1,
          color2,
        )
  • isReadableOption is removed in favor of options to isReadable.

v1.0.0

05 Mar 15:26
2f0a67e
Compare
Choose a tag to compare

All functions in original library have bindings.