Skip to content

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

@iocouto

Description

@iocouto

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions