{"id":47195,"date":"2025-03-25T14:26:20","date_gmt":"2025-03-25T18:26:20","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=47195"},"modified":"2025-03-25T14:26:20","modified_gmt":"2025-03-25T18:26:20","slug":"matching-drop-shadows","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2025\/03\/25\/matching-drop-shadows\/","title":{"rendered":"Matching Drop Shadows"},"content":{"rendered":"<p><a href=\"https:\/\/bjango.com\/articles\/matchingdropshadows\/\">Mark Edwards<\/a>:<\/p>\n<blockquote cite=\"https:\/\/bjango.com\/articles\/matchingdropshadows\/\">\n<p>The image above shows the same drop shadow values, rendered by CSS on the web, Android, and iOS. It&rsquo;s a dark and extreme shadow, to make the differences more pronounced. The shadows are black, with no X offset, 24px Y offset, and a 24px blur radius. I&rsquo;ve used &ldquo;px&rdquo; when noting the values, but when building each test app to generate the images for this article, I used the platform&rsquo;s equivalent unit &mdash; dp on Android, and points on iOS.<\/p>\n<p>The CSS and Android examples may look the same, but they&rsquo;re slightly different. The image below demonstrates that the Android shadow is slightly blurrier.<\/p>\n<p>[&#8230;]<\/p>\n<p>The Android blur radius scale factor isn&rsquo;t quite as straight forward. Android uses Skia for a lot of its rendering, and the <a href=\"https:\/\/github.com\/google\/skia\/blob\/de4799f97cd0b4bd971d016ed179f8c854ef4c29\/src\/core\/SkBlurMask.cpp#L28-L39\">source code mentions scaling the blur by 1 \/ sqrt(3)<\/a> because &ldquo;Safari does the same&rdquo;, and that &ldquo;it actually should be 1&rdquo;. Those comments are quite old, and Safari has since changed to be in line with the CSS spec. That means Android&rsquo;s shadows don&rsquo;t match CSS, because of Safari. Wild.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Mark Edwards: The image above shows the same drop shadow values, rendered by CSS on the web, Android, and iOS. It&rsquo;s a dark and extreme shadow, to make the differences more pronounced. The shadows are black, with no X offset, 24px Y offset, and a 24px blur radius. I&rsquo;ve used &ldquo;px&rdquo; when noting the values, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-03-25T18:26:22Z","apple_news_api_id":"b0fb588d-2adf-40ba-b254-54527213cb63","apple_news_api_modified_at":"2025-03-25T18:26:22Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AsPtYjSrfQLqyVFRSchPLYw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[248,338,1345,279,456,34,31,30,103,1318,328],"class_list":["post-47195","post","type-post","status-publish","format-standard","hentry","category-technology","tag-android","tag-css","tag-figma","tag-firefox","tag-googlechrome","tag-graphicdesign","tag-ios","tag-mac","tag-safari","tag-sketch","tag-webkit"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/47195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=47195"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/47195\/revisions"}],"predecessor-version":[{"id":47196,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/47195\/revisions\/47196"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=47195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=47195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=47195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}