]> cat aescling's git repositories - mastodon.git/commit
Fix thumbnail color extraction (#14464)
authorThibG <thib@sitedethib.com>
Sun, 2 Aug 2020 16:47:44 +0000 (18:47 +0200)
committerGitHub <noreply@github.com>
Sun, 2 Aug 2020 16:47:44 +0000 (18:47 +0200)
commit0ebc8d8626e3982696d1bb3876ec378a3bce81c9
tree12b9080bb30f26f94883bd27176b5d958b35d2f9
parent635b6a0f1af21bd4055f950930a681aa0a96535b
Fix thumbnail color extraction (#14464)

* Fix contrast calculation for thumbnail color extraction

Luminance calculation was using 0-255 RGB values instead of 0-1 sRGB values,
leading to incorrectly-computed contrast values.

Since we use ColorDiff already, just use its XYZ colorspace conversion code
to get the value.

* Require at least 3:1 contrast for both accent and foreground colors

* Lower required contrast for the accent color
lib/paperclip/color_extractor.rb