UNPKG

@akveo/nga-theme

Version:
100 lines 3.79 kB
/** * @license * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Injectable } from '@angular/core'; import 'rxjs/add/operator/publish'; // TODO: move to theme config var builtInThemes = [ { name: 'default', base: null, variables: { fontMain: 'SegoeUI', fontSecondary: 'Exo', colorBg: '#edf1f7', colorFg: '#d1d1ff', colorFgHeading: '#828282', colorFgHint: '#a1a1e5', colorFgHighlight: '#00f9a6', separator: '#d1d1ff', colorGray: 'rgba(81, 113, 165, 0.15)', colorNeutral: 'transparent', colorWhite: '#ffffff', colorDisabled: 'rgba(255, 255, 255, 0.4)', colorPrimary: '#a48aff', colorSuccess: '#00e172', colorInfo: '#4e9fff', colorWarning: '#e5c742', colorDanger: '#ff666d', layoutBg: '#edf1f7', }, }, { name: 'cosmic', base: 'default', variables: { colorBg: '#3d3780', colorFg: '#a1a1e5', colorFgHeading: '#ffffff', separator: '#342e73', colorGray: 'rgba(81, 113, 165, 0.15)', colorNeutral: 'transparent', colorWhite: '#ffffff', colorPrimary: '#7659ff', colorSuccess: '#00d977', colorInfo: '#0088ff', colorWarning: '#eae95f', colorDanger: '#ff386a', layoutBg: '#2c2961', }, }, { name: 'light', base: 'default', variables: { colorBg: '#white', colorFg: '#2f3234', }, }, ]; // TODO rename it to themeRegistry or smth similar as currently it overlaps with theme options var NgaThemeConfig = (function () { function NgaThemeConfig() { var _this = this; this.themes = {}; builtInThemes.forEach(function (theme) { _this.register(theme.variables, theme.name, theme.base); }); } NgaThemeConfig.prototype.register = function (config, themeName, baseTheme) { var base = this.has(baseTheme) ? this.get(baseTheme) : {}; this.themes[themeName] = Object.assign({}, base, config); }; NgaThemeConfig.prototype.has = function (themeName) { return !!this.themes[themeName]; }; NgaThemeConfig.prototype.get = function (themeName) { if (!this.themes[themeName]) { throw Error("NgaThemeConfig: no theme '" + themeName + "' found registered."); } return Object.assign({}, this.themes[themeName]); }; return NgaThemeConfig; }()); NgaThemeConfig = __decorate([ Injectable(), __metadata("design:paramtypes", []) ], NgaThemeConfig); export { NgaThemeConfig }; //# sourceMappingURL=themeConfig.service.js.map