Tec*_*ico 6 css sass ionic-framework ionic2 ionic3
我有这个问题...我的颜色现在是白色的,我的代码是这样的:
<ion-header >
<ion-navbar>
<ion-title>
HELLO
</ion-title>
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
使用此选项更改颜色很容易(主要,次要,危险,光线,黑暗)
<ion-header >
<ion-navbar danger>
<ion-title>
HELLO
</ion-title>
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
但我的问题是当我想使用自定义颜色时.有人知道如何解决它?提前致谢.
最好的祝福.
seb*_*ras 19
有两种方法可以执行此操作,具体取决于您是只想在一个页面中更改颜色,还是要在应用程序的所有页面中更改颜色:
就像你在这里看到的一样
要更改主题,只需
$colors在src/theme/variables.scss文件中调整地图 :
$colors: (
// ...
newcolor: #55acee
)
Run Code Online (Sandbox Code Playgroud)
然后在视图中使用它
<ion-header>
<ion-navbar color="newcolor">
<ion-title>
HELLO
</ion-title>
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,您需要在variables.scss文件中添加以下内容以覆盖Ionic的默认值:
$toolbar-ios-background: #55acee;
$toolbar-md-background: #55acee;
$toolbar-wp-background: #55acee;
Run Code Online (Sandbox Code Playgroud)
嗨,我怎样才能在app/theme/app.variables.scss中添加渐变?
您可以添加您将要使用的颜色src/theme/variables.scss:
$header-first-color: #AAAAAA;
$header-last-color: #000000;
Run Code Online (Sandbox Code Playgroud)
然后设置规则以使用它(app.scss如果要将其应用于每个页面,则在page-name.scss文件中;如果要将其应用于单个页面,则在文件中):
ion-header {
.toolbar-background {
background: linear-gradient(135deg, $header-first-color 0%, $header-last-color 100%);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16674 次 |
| 最近记录: |