![]() Safari adds a grey background to dark icons in dark mode (for example, Wikimedia Foundation, Github), so this workaround isn't necessary for legibility.Īdd two link rel=icon elements with ids for later: Ĭreate a CSS media matcher: matcher = window.matchMedia('(prefers-color-scheme: dark)') Īdd/remove the elements from the document's head: lightSchemeIcon = document.querySelector('link#light-scheme-icon') ĭarkSchemeIcon = document. ![]() In Chrome 76 with -enable-blink-features=MediaQueryPrefersColorScheme, this correctly sets the icon when the page is loaded, but does not respond dynamically to changes in dark mode. Adding and removing an icon from the document’s head works in Firefox but not Safari:Ĭhrome is still implementing (prefers-color-scheme: dark), so the jury’s still out. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |