Closed xMrAfonso closed 2 years ago
These are also possible with WebSK. You can set session variables for these things, or local storage via javascript, or you can even add a database into the mix.
As said, I want to get the browsers default theme. Not be able to set one using sessions. Browsers have default themes that users can choose.s
Hello, Sorry that you must wait such a long time :(
Browser default theme U have two ways to do that. One is in CSS another in Java Script
Css:
@media (prefers-color-scheme: dark) {}
Tutorial: https://css-tricks.com/dark-modes-with-css/
Java Script:
if(window.matchMedia('(prefers-color-scheme: dark)').matches){}
Tutorial: https://stackoverflow.com/questions/56393880/how-do-i-detect-dark-mode-using-javascript
Browser language To get language you need to look to headers of http request. This thing is not implemented yet, but i'm working on it :)
Goodbye and wait for next update! PS: And next time, look at https://google.com
I already knew about those…. I am not new to html and css…. I asked for an option, that’s all.
Hi again,
Do u think about something like page's default theme
? It is supposed to be in our html template system, or in skript?
So why u didn't send that? It can save a lot of time :)
HI! This manage the user's end page, and therefore don't ave anything related to Websk. However, you can still save and restore theme configured for each IP in your Script in variable or YAML, then apply the page you want for it later. There's a lot of easy way in JavaScript to manage cookies, feel free to even make your own API using Websk to receive JavaScript's request for changing theme.
I created PR that adds option to get header! Now you can check default language of browser!
Unsure if it's doable as a backend, but we should be able to get user preferences like dark or light theme, or even language of the system/browser. These things are possible with other languages.