Color Themes
Pip.WebUI.Themes module contains a mechanism to define and dynamically switch color themes for both Angular Material and custom controls.
pipTheme service allows to change color themes in the application.
Register pipTheme module in angular module dependencies.
angular;
Use setCurrentTheme function for change current theme. Use initializeTheme function if you want use css classes for theme colors. You need to call this function after initializing the theme with $mdThemingProvider.
In Pip.WebUI.Themes module has Default and Bootbarn configuration. You can also add existing themes: blue, pink, green, amber, orange,
Default Themes configuration includes blue, pink, amber, orange, green, navy and grey themes. Register pipTheme.Default module in angular module dependencies before registration pipTheme module.
Register pipTheme module in angular module dependencies.
angular;
For change theme use pipTheme.setCurrentTheme(theme); function
You can register Custom Theme. Configuring of the default theme is done by using the $mdThemingProvider during application configuration. You can specify a color palette for a given color intention by calling the appropriate configuration method (theme.primaryPalette, theme.accentPalette, theme.warnPalette, theme.backgroundPalette).
{ 'use strict'; var thisModule = angular; thisModule; { var greenBackgroundPalette = $mdThemingProvider; $mdThemingProvider; var greenPrimaryPalette = $mdThemingProvider; $mdThemingProvider; var greenAccentPalette = $mdThemingProvider; $mdThemingProvider; $mdThemingProvider ; $mdThemingProvider; }};
You may add variables for themes class and after call mixin generate-theme.
@color-green-primary: rgba76, 175, 80, 1;@color-green-accent: rgba255, 171, 0, 1;@color-green-hue: rgba76, 175, 80, .54;@color-green-accent-hue: rgba255, 171, 0, .54;@color-green-warm: rgba255, 171, 0, .38; @color-primary: rgba0, 0, 0, 0.87;@color-secondary: rgba0, 0, 0, 0.54;@color-error: rgb244, 67, 54;@color-badge: rgba255, 82, 82, 1;@color-toast: rgba46, 46, 46, 1;@color-divider: rgba0, 0, 0, 0.12;@color-window: rgb238, 238, 238;@color-content: rgb250, 250, 250; @color-green-theme: @color-green-primary // primary color @color-green-accent // accent color @color-green-hue // primary color wich some opacity @color-primary // text color @color-secondary // text color with some opacity @color-error // error color @color-divider // color for dividers @color-toast // background color for toasts @color-error // background color for badge @color-content // background color for content window @color-window // background color for window @color-green-accent-hue; // accent color wich some opacity .generate-themegreen, @color-green-theme;
You can use theme in html
// Use theme class in html color-primary color-primary-bg color-accent color-accent-bg ... Primary Hue 1
Register pipTheme module in angular module dependencies and use pipTheme.use function for change current theme.
angular; ... thisModule
And more... Please, look at User's guide for details.
Learn more about the module
- User's guide
- Online samples
- API reference
- Developer's guide
- Changelog
- Pip.WebUI project website
- Pip.WebUI project wiki
- Pip.WebUI discussion forum
- Pip.WebUI team blog
Module dependencies
- pip-webui-lib: angular, angular material and other 3rd party libraries
License
This module is released under MIT license and totally free for commercial and non-commercial use.