SamsungInternet / globalgoals

MIT License
0 stars 0 forks source link

Potential semantic solution for prefers color scheme, #17

Open AdaRoseCannon opened 4 years ago

AdaRoseCannon commented 4 years ago

Potentially replace, this could be a neat alternative needs testing

/*prefers-color-scheme support on older browser*/
if (window.matchMedia('(prefers-color-scheme: dark)').media === 'not all') {
    document.documentElement.style.display = 'none';
    document.head.insertAdjacentHTML(
        'beforeend',
        '<link rel="stylesheet" href="css/gg-light.css" onload="document.documentElement.style.display = \'\'">'
    );
}

with

<link href="css/gg-light.css" rel="stylesheet" media="screen and (prefers-color-scheme: dark)">