window.getComputedStyle
equivalent style()
function in CSS
#8968
Labels
Closed as Duplicate
Closed as Question Answered
Used when the issue is more of a question than a problem, and it's been answered.
Hi 👋🏻
I really love how CSS is evolving these days and really loved #CSSDay ❤️
I'm building UI framework Anu and needed some CSS magic at some point. These magic includes:
I wanted to share the idea got recently on CSS functions. We already have currentColor & there's already proposal for currentBackgroundColor. If we at these with bird view it comes down to JS version
window.getComputedStyle
. With JS'swindow.getComputedStyle
we can easily fullfil requirement ofcurrentColor
¤tBackgroundColor
If we have similar function in CSS, let's say
style()
then we don't need keywords likecurrentColor
¤tBackgroundColor
at all 😱Syntax
We can take it to the next level by adding support for selector and not limiting to current element's context:
IDK if this is technically possible but just sharing my thoughts. If this is possible this unlocks great possibilities for UI design.
There's also question on what about invalid values or circular dependencies discussed in #5292 or assingning invalida values to property.
The text was updated successfully, but these errors were encountered: