Skip to content

[0.8][styling] Want to define custom variables in the same scope as their references  #1406

Description

@morethanreal

I want to give a custom element a default color from the shared theme while allowing a hook for the user to customize the color by doing this:

* {
  --my-element-background-color: var(--my-theme-background-color);
}

:host {
  background-color: var(--my-element-background-color);
}

It seems like the variable definition must be in a different scope than the reference to the variable.

Activity

  1. sorvell commented on May 22, 2015

    @sorvell
    Contributor

    Variables now support default values via syntax like this:

    background-color: var(--my-element-background-color, --my-element-default-background-color);
    

    In addition properties can be defined in the scope that they are used via :host or :root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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