gpt4 book ai didi

angular-material - 在不丢失波纹效果的情况下更改角 Material 开关的背景颜色

转载 作者:行者123 更新时间:2023-12-04 23:19:05 28 4
gpt4 key购买 nike

如何在不失去波纹效果的情况下更改角 Material 开关按钮的颜色?

请在此处查看代码笔:http://codepen.io/shyambhiogade/pen/LpNGBP

我已将颜色更改为 #03A9F4现在涟漪效应不能正常工作......

代码如下:

<div class="inset switchdemoBasicUsage" ng-controller="SwitchDemoCtrl" ng-app="MyApp">
<md-switch class="md-primary" md-no-ink="" aria-label="Switch No Ink" ng-model="data.cb5">
Switch (md-primary): No Ink
</md-switch>
</div>

最佳答案

您需要使用 $mdThemingProvider提供者修改元素样式。

http://plnkr.co/edit/FRwd2fmmn0byBVUKYKi9?p=preview

angular.module('MyApp', ['ngAria', 'ngAnimate', 'ngMaterial'], function($mdThemingProvider) {
var blueTheme = $mdThemingProvider.theme('blueTheme', 'default');
var bluePalette = $mdThemingProvider.extendPalette('blue', {
'500': '#03A9F4'
});
$mdThemingProvider.definePalette('bluePalette', bluePalette);
blueTheme.primaryPalette('bluePalette');
})

.controller('SwitchDemoCtrl', function($scope) {});
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.11.0/angular-material.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.11.0/angular-material.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular-aria.min.js"></script>
</head>
<body ng-app="MyApp" md-theme="blueTheme" ng-controller="SwitchDemoCtrl">
<div class="inset switchdemoBasicUsage">

<md-switch class="md-primary" md-no-ink="" aria-label="Switch No Ink" ng-model="data.cb5">
Switch (md-primary): No Ink
</md-switch>
</div>
</body>
</html>

关于angular-material - 在不丢失波纹效果的情况下更改角 Material 开关的背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32620256/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com