vincentdoerig / latex-css

LaTeX.css is a CSS library that makes your website look like a LaTeX document
https://latex.vercel.app
MIT License
2.74k stars 125 forks source link

automatic color mode using latex css #64

Closed 7zx closed 9 months ago

7zx commented 9 months ago

How do i enable dark or light mode based on the user OS color preferences? I read the docs, but i didn't really understand, what do i have to change to enable this feature? I don't mean the toggle button by the way,

vihuna commented 9 months ago

It's explained in "Dark Mode" section.

"If you want enable dark mode based on the prefers-color-scheme CSS media query, then use the latex-dark-auto class instead."

I.e. you only need to add the class latex-dark-auto to body HTML element:

<body id="top" class="latex-dark-auto">
7zx commented 9 months ago

I did that, didn’t work

vihuna @.***> escreveu em qua., 1/11/2023 às 18:52 :

It's explained in "Dark Mode" section https://latex.vercel.app/#dark-mode.

"If you want enable dark mode based on the prefers-color-scheme CSS media query, then use the latex-dark-auto class instead."

I.e. you only need to add the class latex-dark-auto to body HTML element:

— Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread.Message ID: ***@***.***>
vihuna commented 9 months ago

I tested it before my comment yesterday and I have tested again today (see video, Firefox on the left, Chrome on the right; Gnome DE).

https://github.com/vincentdoerig/latex-css/assets/60484272/ce7b89f9-fce0-4a5a-b06c-46f3344df55b

Because prefers-color-scheme involves Desktop/OS theme preferences, it can be more complicated; I don't know what happens in Windows, macOS.

It may be helpful if you give more information, like the OS/Desktop and the Browser that you are using.

7zx commented 9 months ago

i guess it was the cache :/ it works now tho, thanks!