首页 > 解决方案 > 如何在 nativescript 中使用自定义主题?

问题描述

我目前正在开发一个可能具有不同主题的应用程序,具体取决于客户端,以前此功能是使用akylas-teme 制作的

但我将项目迁移到 angular 11 和 nativescript 7,所以这个解决方案不再适用于我。

我怎样才能执行与以前相同的功能?为每个客户提供动态主题。

如果需要执行解决方案,我将提供有关我的项目的更多信息,非常感谢

标签: angularnativescriptnativescript-plugin

解决方案


将根类添加到您的页面

xml/html:

<Page class="blue-theme">...

js:

changeTheme () {
    page.className = 'red-theme';
}

scss:

@import "~@nativescript/theme/core";
@import "~@nativescript/theme/default";
.blue-theme {
    @import "~@nativescript/theme/blue";
}

推荐阅读