/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ (function() { /* jshint validthis: true */ 'use strict'; /* * sgFolderStylesheet - Add CSS stylesheet for a folder's color (addressbook or calendar) * @memberof SOGo.Common * @restrict attribute * @param {object} ngModel - the object literal describing the folder (an Addressbook or Calendar instance) * @example: */ function sgFolderStylesheet() { return { restrict: 'E', require: 'ngModel', scope: { ngModel: '=' }, replace: true, bindToController: true, controller: sgFolderStylesheetController, controllerAs: 'cssCtrl', template: [ '' ].join('') }; function sgFolderStylesheetController() { var vm = this; vm.contrast = contrast; // defined in Common/utils.js vm.transparent = function(hex, ratio) { var color = hexToRgb(hex); return ['rgba(' + color.r, color.g, color.b, ratio + ')'].join(','); }; } } angular .module('SOGo.Common') .directive('sgFolderStylesheet', sgFolderStylesheet); })();