From 6f816958f43f86665f1a14541f387fcb5e315e39 Mon Sep 17 00:00:00 2001 From: Nicco Date: Mon, 6 Jan 2020 23:50:07 +0100 Subject: [PATCH] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index d40459e..6b13a71 100755 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ npm i use-light-switch There was no library that included typings 🤕 +## 🛠 Compatibility & How it works + +We leverage two browser features. + +1. [prefers-color-scheme](https://caniuse.com/#feat=prefers-color-scheme) media query. +2. [matchMedia](https://caniuse.com/#feat=matchmedia) + +The first one is a css media query that gives us the actual user preference. with `window.matchMedia` we can get it inside of javascript and even listen on changes, which makes it reactive. + ## 🚀 Quickstart ```typescript