Skip to content

[FR] :host-context - Allow theming of your app #1706

Open
@larssn

Description

@larssn

I'd like to request support for :host-context

It doesn't seem to be supported currently.
With it, it would be possible to easily theme your app without breaking component encapsulation.
Currently, all theming has to be in global (s)css classes which is a mess to maintain.

Small example:
my-component.html
<Label text="Hello World"></Label>

my.component.scss

:host-context(.theme-light) Label {
  background-color: white;
  color: black;
}

:host-context(.theme-dark) Label {
  background-color: black;
  color: white;
}

app.component.html
<StackLayout [ngClass]="{'theme-light': light, 'theme-dark': !light}"><router-outlet></router-outlet></StackLayout>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions