3

I am using Kendo UI with Angular 7 application. The application needs to support changing themes on the fly. For example, some user might like to have Light mode while others will prefer the Dark mode.

Kendo UI has a very good support for themes but the problem is that themes can only be set on the compile time.

As per their recommendations, specifying the theme should be a part of the angular.json file, like the following.

"styles": [           
   "node_modules/@progress/kendo-theme-bootstrap/dist/all.css",
   "src/styles.scss"
]

but this will only compile to embedded CSS inside the root page. We cannot change it on the fly.

The alternative approach I am considering is to add the CSS to index.html like,

<link rel="stylesheet" href="node_modules/@progress/kendo-theme-bootstrap/dist/all.css">

and to try this solution.

Is this the right way to solve the problem or there is a better solution than this one?

Kashif Nazar
  • 16,731
  • 5
  • 25
  • 43
  • I am looking for the same. If you find anything then please update here. – Dips Feb 25 '19 at 13:26
  • 1
    i got it working with second approach. put css in index.html file and make it enable/disable. Please let me know if you need help. – Dips Mar 27 '19 at 13:48
  • @dips. Thanks. I went for the second approach just like you did. No doubt, great minds think alike :p – Kashif Nazar Mar 29 '19 at 06:37

0 Answers0