Ionic 3: Как динамически переключать тему Ionic по умолчанию? - PullRequest
0 голосов
/ 23 октября 2018

Учитывая, что Ionic 3 поставляется с ionic.theme.default и ionic.theme.dark, я задумался, как переключаться между этими 2 темами во время выполнения.

// App Theme
// --------------------------------------------------
// Ionic apps can have different themes applied, which can
// then be future customized. This import comes last
// so that the above variables are used and Ionic's
// default are overridden.

@import "ionic.theme.default";
//@import "ionic.theme.dark";

Я пытался создать оболочку с помощью инжектора состояния приложения для переключения между моими собственными темами ( после отличного среднего поста Райана Гордона ), и сейчас язастрял в ссылках на ионные темы по умолчанию в моем scss.

// App Theme
// --------------------------------------------------
// Ionic apps can have different themes applied, which can
// then be future customized. This import comes last
// so that the above variables are used and Ionic's
// default are overridden.

@import "ionic.theme.default";
//@import "ionic.theme.dark";
@import "../theme/default.theme"; // is empty so only shows ionic theme default which is already loaded by the line above
@import "../theme/dark.theme"; // has a simple class .theme-dark which should reference the ionic.theme.dark 


//default.theme.scss content
.theme-default {
  // empty on purpose as default theme is already loaded
}

//dark.theme.scss content
.theme-dark {
  @import "ionic.theme.dark"; // here I would like to reference ionics dark theme to override the default theme at runtime
}

с классом .theme-dark Я хотел бы загрузить темную тему ionic, чтобы переопределить текущую загруженную тему во время выполнения.Моя проблема заключается в правильной ссылке на темную тему.

Как правильно ссылаться на темную тему в моем классе?Или где я могу найти содержимое ionic.theme.dark?

...