Fix text color contrast on social previews (#19163)

This commit is contained in:
James Wu 2023-03-18 02:37:19 +09:00 committed by GitHub
parent bfe797f44d
commit 78bb52a627
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
<% accent_color = Color::CompareHex.new([user_colors(@article.user)[:bg], user_colors(@article.user)[:text]]).biggest %>
<% dark_color = Color::CompareHex.new([user_colors(@article.user)[:bg], user_colors(@article.user)[:text]]).brightness(0.8) %>
<% dark_color = Color::CompareHex.new([user_colors(@article.user)[:bg], user_colors(@article.user)[:text]]).brightness(0.8). %>
<% then { |color| Color::Accessibility.new(color).low_contrast? ? "black" : color } %>
<style>
body {
background: <%= accent_color %>;