You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CSS needs to be able to set style rules in reference to the values that were saved in the localStorage of the browser. Like for color settings, or text size settings, or position settings.
Here is an example to understand why.
CSS rule example for the user-set color preferences.
Similar as we do in the attribute selector rules :
html[localStorage( ColorTheme == dark )] { background: black ; }
..or...
html[localStorage( ColorTheme == green )] { background: green ; }
OR as we do in the media rules :
@localStorage( ColorTheme == dark ) {
body { background: black ; }
}
Such rules would be able to set the black background for the html tag, if the localStorage cell list of ColorTheme had the "dark" entry value in the list.
The read-only access to the localStorage of the browser would make the CSS truly dynamic and responsive to the user input. Users apps would be able allow to set and remember the personal style settings. Positions of the movable page elements would be possible to be remembered, if the user wanted to do so.
The write access changes should be still left to the JavaScript side.
Good Day fellow travelers !
The text was updated successfully, but these errors were encountered:
Dorson
changed the title
CSS needs rule references to localMemory values, to be responsive to user input.
[css-localMemory-rule] CSS needs rule references to localMemory values, to be responsive to user input.
Apr 9, 2020
Dorson
changed the title
[css-localMemory-rule] CSS needs rule references to localMemory values, to be responsive to user input.
[CSS-localMemory-rule] CSS needs rule references to localMemory values, to be responsive to user input.
Apr 9, 2020
This should be addressed when we add custom media queries; on page load you can query localStorage yourself and set the MQs accordingly.
It wouldn't be appropriate for CSS to directly interface with localStorage; that is one of many ways to store local state in a page. (And in general, one of the less good ones, due to it providing sync access to a potentially-slow storage backend.)
Yes, CSS should directly interface with localStorage values OR similar, alternative settings memory, because user style settings are set in there. Read-only access is OK for that.
It's the job of the CSS to comply with the style rules that the user selected and saved.
In the current state, we are left to use the JavaScript to do the job of the CSS, when we need to remember and set the same CSS class rules for user preferences, and set them again on every page load by JavaScript, instead of directly making style rules that refer to the localStorage values for the user style settings.
It's NOT about the localStorage itself. Could be any other memory storage. It's about the access to style setting values that were made by the user.
Dorson
changed the title
[CSS-localMemory-rule] CSS needs rule references to localMemory values, to be responsive to user input.
[CSS-localStorage-rule] CSS needs rule references to localStorage values, to be responsive to user input.
Apr 9, 2020
Uh oh!
There was an error while loading. Please reload this page.
[css-localStorage-rule]
CSS needs to be able to set style rules in reference to the values that were saved in the localStorage of the browser. Like for color settings, or text size settings, or position settings.
Here is an example to understand why.
CSS rule example for the user-set color preferences.
Similar as we do in the attribute selector rules :
OR as we do in the media rules :
Such rules would be able to set the black background for the html tag, if the localStorage cell list of ColorTheme had the "dark" entry value in the list.
The read-only access to the localStorage of the browser would make the CSS truly dynamic and responsive to the user input. Users apps would be able allow to set and remember the personal style settings. Positions of the movable page elements would be possible to be remembered, if the user wanted to do so.
The write access changes should be still left to the JavaScript side.
Good Day fellow travelers !
The text was updated successfully, but these errors were encountered: