Loading tutorials
prefers-color-scheme media query: what it reports, how to write rules against it, and where it goes wrong. It assumes you know basic HTML and CSS, including selectors and the cascade. It also assumes you can read hex and rgb color values and make small DOM changes with Java7 min readrgb() colors. It also assumes you can read basic JavaScript that touches the DOM. The previous cha6 min readprefers-color-scheme media query, and that you know the cascade and inheritance. Earlier chapters built a theme from your own colors. Here you tell the browser which themes the page supports, so it can theme the parts of the page that 7 min readprefers-color-scheme media query, CSS custom properties, and the color-scheme property from the earlier chapters. You should also be comfortable reading a basic data-theme toggle. Here you will replace paired light and dark rules with one declaration, and lear6 min readprefers-color-scheme media query, and you can read and set DOM attributes in JavaScript. It builds on the semantic color tokens and the color-scheme property from the earlier chapters. By the end you will have a three-wa6 min readdata-theme attribute on the root element that overrides prefers-color-scheme. It also assumes you can read and write DOM attributes and use localStorage. Here you will make the user's choice persist acr6 min readprefers-color-scheme: dark media query. This chapter is about which values to put in the dark set. It covers how to choose them, how to relate them to each other, and where the usual shortcuts fail6 min readprefers-color-scheme, and that you can read basic JavaScri6 min read#121212 background. This chapter covers the main ways to adapt images, icons, canvas drawings, and embedded content to the active them6 min readprefers-color-scheme media query, color-scheme: light dark, and a toggle that sets data-theme and saves the choice in localStorage. You should be comfortable opening browse7 min readdata-theme toggle, and the saved preference from the earlier chapters. You should be comfortable with CSS custom properties, matchMedia, and editing the <head> of an HTML document.6 min read