{"id":4781,"date":"2024-12-10T13:29:18","date_gmt":"2024-12-10T18:29:18","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=4781"},"modified":"2024-12-10T13:29:18","modified_gmt":"2024-12-10T18:29:18","slug":"automatically-contrasted-colors","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/automatically-contrasted-colors\/","title":{"rendered":"Automatically Contrasted Colors"},"content":{"rendered":"\n<p>What is a good contrast text color on a black background? White. What about on a white background? Black. What about on #f06d06? Less clear. <a href=\"https:\/\/bsky.app\/profile\/devongovett.bsky.social\/post\/3lcedcdj4qk2y\">Devon Govett posted<\/a> a <a href=\"https:\/\/codepen.io\/devongovett\/pen\/QwLbRrW\">good trick<\/a> to having CSS pick for you, which works across browsers today. Lea Verou <a href=\"https:\/\/lea.verou.me\/blog\/2024\/contrast-color\/\">has a much deeper dive<\/a>.  There is <em>supposed<\/em> to be <a href=\"https:\/\/css-tricks.com\/exploring-color-contrast-for-the-first-time\/\">a CSS <code>color-contrast()<\/code> function<\/a>, but it&#8217;s not usable across browsers yet. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a good contrast text color on a black background? White. What about on a white background? Black. What about on #f06d06? Less clear. Devon Govett posted a good trick to having CSS pick for you, which works across browsers today. Lea Verou has a much deeper dive. There is supposed to be a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4782,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[49,81,7],"class_list":["post-4781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-accessibility","tag-color","tag-css"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/12\/pexels-photo-2856028.jpeg?fit=1880%2C1251&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=4781"}],"version-history":[{"count":1,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4781\/revisions"}],"predecessor-version":[{"id":4783,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/4781\/revisions\/4783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/4782"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=4781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=4781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=4781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}