Question: is there a way to import css style sheet on the fly in Vaadin14 ? I use `@CssImport("./views/main/main-view.css")` at the top of my class, and

```
Button lumoBtn = new Button("Lumo", click -> {
            UI ui = this.getUI().get();
            ThemeList themeList = ui.getCurrent().getElement().getThemeList(); //
            if (themeList.contains(Lumo.DARK)) { //
                themeList.remove(Lumo.DARK);
            } else {
                themeList.add(Lumo.DARK);
            }
        });

```

to change between Dark and Light on the fly. But now I want to be able to change between Material, Lumo and others AbstracTheme on the fly too.

Answer: 
You can't switch between themes at runtime, it's a missing feature: <https://github.com/vaadin/flow/issues/5163>
The solution I found to go around it:
Create variants of theme, and change from one to another on the fly.

* *java file*

```
UI ui = this.getUI().get();
ThemeList themeList = ui.getCurrent().getElement().getThemeList();
// remove curent theme
for (String theme : themeList){
   themeList.remove(theme);
}
switch (event.getValue()) {
    case "variant1":
        themeList.add(Lumo.LIGHT);
        img.setSrc("images/variant1.png");
        break;
    case "variant2":
        themeList.add("variant2");
        img.setSrc("images/variant2.png");
        break;
    case "variant3":
        themeList.add("variant3");
        img.setSrc("images/variant3.png");
        break;
}

```

* *css file*

```
//I used the lLumo theme from Vaadin as base, with some colors modifications
html {
--lumo-primary-color: hsl(189, 57%, 38%);
--lumo-primary-color-70pct: hsla(189, 57%, 38%, 0.7);
--lumo-primary-color-50pct: hsla(189, 57%, 38%, 0.5);
--lumo-primary-color-10pct: hsla(189, 57%, 38%, 0.1);
}
[theme~="variant2"]{
--lumo-primary-color: hsl(189, 57%, 38%);
--lumo-primary-color-70pct: hsla(189, 57%, 38%, 0.7);
--lumo-primary-color-50pct: hsla(189, 57%, 38%, 0.5);
--lumo-primary-color-10pct: hsla(189, 57%, 38%, 0.1);
}
[theme~="varinat3"]{
--lumo-primary-color: hsla(88, 62%, 40%);
--lumo-primary-color-70pct: hsla(88, 62%, 40%, 0.7);
--lumo-primary-color-50pct: hsla(88, 62%, 40%, 0.5);
--lumo-primary-color-10pct: hsla(88, 62%, 40%, 0.1);
}

```