adobe / leonardo

Generate colors based on a desired contrast ratio
http://www.leonardocolor.io
Apache License 2.0
1.96k stars 107 forks source link

Issue 60 fix: binary search to return closest larger number #104

Closed bhavika24 closed 3 years ago

bhavika24 commented 4 years ago

Description

https://github.com/adobe/leonardo/issues/60 Binary search should return closest value larger than search value

  1. packages\contrast-colors\index.js - Updated binarySearch function to return the closest larger number. If there are no larger numbers, it returns the closest smaller number
  2. packages\contrast-colors\test\binarySearch.test.js - Added a test case to return closest match (descending)

Motivation

Screenshots

image image

To-do list