Logo background contrast bw images #481
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Used canvas to render and read image data pixels. calculated average color value and if the overall contrast value is more than 155, assuming the image is on the whiter side, the background will be black which solves the issue of png images blending with the background.
ref:
https://stackoverflow.com/questions/2541481/get-average-color-of-image-via-javascript
https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color
https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color