Home

Awesome

bs-randomColor

BuckleScript bindings for davidmerfield/randomColor (library for generating attractive random colors). This implementation gives couple functions:

How to install

yarn add bs-randomcolor

Then add bs-randomcolor as a dependency to bsconfig.json:

"bs-dependencies": [
+  "bs-randomcolor"
]

Supported options

Example usages:

open RandomColorRe;

randomColor(); // "#f9a05c"
randomColor(~seed="test", ~format=FormatRgb, ()); // "rgb(249, 160, 92)"
randomColor(~seed="test", ~format=FormatRgba, ~alpha=0.2, ()) // "rgba(249, 160, 92, 0.2)"
randomColor(~seed="test", ~hue=HuePurple, ~luminosity=LuminosityDark, ()) // "#070707"
randomColorMultiple(~seed="test123", ~count=3, ()) // [|"#b6f453", "#4cdbb2", "#f9d759"|]
randomColorMultiple(~seed="test123", ~count=3, ()) // [|"#b6f453", "#4cdbb2", "#f9d759"|]
randomColorRgbArray(~seed="test", ~hue=HueRed, ()) // (137, 4, 44)
randomColorHslArray(~seed="test", ()) // (71, 94.17, 23.69)

More examples in tests :).