I'm working on a design for my webapp, and I'd like a dark theme similar to that seen here.
Sadly I've found the Angular Material Theming Docs very hard to get my head around; no mention of where each colour will be used, how to set a background color or a text color etc.
I'm currently using:
.config(function($mdThemingProvider) {
$mdThemingProvider.definePalette('coolpal', {"50":"#d9ddec","100":"#a6b1d2","200":"#8190bf","300":"#5468a5","400":"#495b90","500":"#252830","600":"#354168","700":"#2a3453","800":"#20283f","900":"#161b2b","A100":"#252830","A200":"#a6b1d2","A400":"#495b90","A700":"#2a3453"});
$mdThemingProvider.definePalette('accentpal', {"50":"#ffffff","100":"#bfe7f7","200":"#8dd5f1","300":"#4ebee9","400":"#32b4e5","500":"#1ca8dd","600":"#1993c2","700":"#157fa7","800":"#126a8c","900":"#0e5570","A100":"#ffffff","A200":"#bfe7f7","A400":"#32b4e5","A700":"#157fa7"});
$mdThemingProvider.definePalette('warnpal', {"50":"#f0fdf9","100":"#adf4dc","200":"#7bedc7","300":"#3ce5ac","400":"#21e1a0","500":"#1bc98e","600":"#17ae7b","700":"#149368","800":"#107855","900":"#0d5d42","A100":"#f0fdf9","A200":"#adf4dc","A400":"#21e1a0","A700":"#149368"});
$mdThemingProvider.theme('default')
.primaryPalette('coolpal').dark()
.accentPalette('accentpal')
.warnPalette('warnpal')
.backgroundPalette('coolpal')
})
With a bit of hacking of colours this works ok, but if I look at the colors in an md-toolbar
, the text is set to rgba(0,0,0,0.87);
and I have no idea how to change it; I assumed it would come from somewhere in my coolpal
theme, but it's not. Here's how my text elements are being styled:
How can I alter $mdThemingProvider
to ensure the text is a light color rather than opaque black?
add("custom-theme"); With adding class="mat-app-background" to the <body> tag, the correct background color will take effect. As you call @include angular-material-theme($custom-theme); within your custom custom-them-css-class mixin, the mat-app-background css-selector will become a nested selector.
Angular Material supports customizing component styles via Sass API as described in the theming guide. This document provides guidance on defining custom CSS rules that directly style Angular Material components.
In Angular Material, a theme is created by composing multiple palettes. In particular, a theme consists of: A primary palette: colors most widely used across all screens and components. An accent palette: colors used for the floating action button and interactive elements.
I would suggest extending an existing palette, much easier.. such as;
var myPalette = $mdThemingProvider.extendPalette('indigo', {
'500': '183863'
});
$mdThemingProvider.definePalette('mine', myPalette);
$mdThemingProvider.theme('default')
.primaryPalette('mine').dark();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With