- Removed deprecated functions
isBright
andisDark
.
- Added experimental function
convertToRGBTriplet
. Purpose of this function is to get any supported color value and convert it to the internal RGB triplet value. - Added a new function
chooseHigherContrast
that can help you to choose the best color compared to the given background (in terms of contrast).
Note for all Flow users: all projects in adeira/universe
now use implicit exact Flow types ({}
for strict objects and { ... }
for open objects, syntax {||}
is deprecated). We do not expect any issues as long as you are using exact_by_default=true
Flow option.
Other changes:
-
New functions
calculateContrastRatio
andisAccessible
were added. -
Functions
isDark
andisBright
has been deprecated. You can useisAccessible
function to make a better decision about colors contrast (for text and background colors for example). The following code snippets show possible migration strategy:isDark(rgb); // replace with: isAccessible(rgb, [255, 255, 255]); // or better to use you actual bg/fg color
isBright(rgb); // replace with: isAccessible(rgb, [0, 0, 0]); // or better to use you actual bg/fg color
Support for Node.js 12 has been removed. This package might continue working on older Node.js versions, however, it's highly recommended upgrading to Node.js version 14 or newer. For more details, see: https://nodejs.org/en/about/releases/, or discuss here: adeira/universe#1588
- added new functions
isBright
andisDark
Initial stable release.