bigskysoftware / bigskysoftware/_hyperscript

[Feature Request] Extend `*computed-` and `measure` syntax to ALL CSS properties

Open
#620 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
172
PR merge metrics
No merged PRs in 30d

Description

Right now, the `*computed-` style property syntax, as well as the `measure` command seem to assume we’re only interested in knowing the current position and size of an element. In fact, there are many times when we need to know the current, computed value of other properties, too — eg. colours that may be overriden by locally-scoped custom CSS properties, or by specific user interactions, such as using ‘light’ or ‘dark’ mode toggle.

In essence, it would be wonderful if `*computed-` and `measure` worked as syntactic sugar for:

``` javascript
function getCurrentPropertyValue(element, property) {
const styles = window.getComputedStyle(element);
const property = styles.getPropertyValue(property);
return property;
}
```

That way, we’d be able to do things like:

```
set my *color to contrastColor( my *computed-background-color)
measure my font-size then put it into the next .size-display
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.