-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
Hey,
When all our project is already detecting the system theme using CSS media queries, it might be useful for Overtype to do the same.
So, it would therefore be interesting to add a new theme named auto for example which could automatically switch between solar and cave themes depending on the system configuration.
On my side, i use something like this to do it manually:
const isDarkThemeQuery = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
const defaultTheme = isDarkThemeQuery && isDarkThemeQuery.matches ? "cave" : "solar";
const [editor] = new OverType(".overtype-editor", {
theme: defaultTheme,
});
if (isDarkThemeQuery) {
isDarkThemeQuery.addEventListener("change", event => {
editor.setTheme(event.matches ? "cave" : "solar");
});
}Feel free to adapt and include this or not.
Thank you for this project.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels