all files / app/core/theming/ fuse-theming.config.js

92.86% Statements 13/14
50% Branches 1/2
100% Functions 5/5
92.86% Lines 13/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                    
(function ()
{
    'use strict';
 
    angular
        .module('app.core')
        .config(config);
 
    /** @ngInject */
    function config($mdThemingProvider, fusePalettes, fuseThemes)
    {
        // Inject Cookies Service
        var $cookies;
        angular.injector(['ngCookies']).invoke([
            '$cookies', function (_$cookies)
            {
                $cookies = _$cookies;
            }
        ]);
 
        // Check if custom theme exist in cookies
        var customTheme = $cookies.getObject('customTheme');
        Iif ( customTheme )
        {
            fuseThemes['custom'] = customTheme;
        }
 
        $mdThemingProvider.alwaysWatchTheme(true);
 
        // Define custom palettes
        angular.forEach(fusePalettes, function (palette)
        {
            $mdThemingProvider.definePalette(palette.name, palette.options);
        });
 
        // Register custom themes
        angular.forEach(fuseThemes, function (theme, themeName)
        {
            $mdThemingProvider.theme(themeName)
                .primaryPalette(theme.primary.name, theme.primary.hues)
                .accentPalette(theme.accent.name, theme.accent.hues)
                .warnPalette(theme.warn.name, theme.warn.hues)
                .backgroundPalette(theme.background.name, theme.background.hues);
        });
    }
 
})();