diff --git a/UI/WebServerResources/js/Common/Common.app.js b/UI/WebServerResources/js/Common/Common.app.js
index 9abbb4561..ba507f1b7 100644
--- a/UI/WebServerResources/js/Common/Common.app.js
+++ b/UI/WebServerResources/js/Common/Common.app.js
@@ -15,6 +15,81 @@
}
})
+ .constant('sgColors', {
+ selection: [
+ '#FFFFFF',
+ '#330033',
+ '#C0C0C0',
+ '#999999',
+ '#666666',
+ '#333333',
+ '#000000',
+ '#FFCCCC',
+ '#FF6666',
+ '#FF0000',
+ '#CC0000',
+ '#990000',
+ '#660000',
+ '#330000',
+ '#FFCC99',
+ '#FF9966',
+ '#FF9900',
+ '#FF6600',
+ '#CC6600',
+ '#993300',
+ '#663300',
+ '#FFFF99',
+ '#FFFF66',
+ '#FFCC66',
+ '#FFCC33',
+ '#CC9933',
+ '#996633',
+ '#663333',
+ '#FFFFCC',
+ '#FFFF33',
+ '#FFFF00',
+ '#FFCC00',
+ '#999900',
+ '#666600',
+ '#333300',
+ '#CCCCCC',
+ '#66FF99',
+ '#33FF33',
+ '#33CC00',
+ '#009900',
+ '#006600',
+ '#003300',
+ '#99FFFF',
+ '#33FFFF',
+ '#66CCCC',
+ '#00CCCC',
+ '#339999',
+ '#336666',
+ '#003333',
+ '#CCFFFF',
+ '#66FFFF',
+ '#33CCFF',
+ '#3366FF',
+ '#3333FF',
+ '#000099',
+ '#000066',
+ '#CCCCFF',
+ '#9999FF',
+ '#6666CC',
+ '#6633FF',
+ '#6600CC',
+ '#333399',
+ '#330099',
+ '#FFCCFF',
+ '#FF99FF',
+ '#CC66CC',
+ '#CC33CC',
+ '#993399',
+ '#663366',
+ '#99FF99'
+ ]
+ })
+
// md break-points values are hard-coded in angular-material/src/core/util/constant.js
// $mdMedia has a built-in support for those values but can also evaluate others
// For some reasons, angular-material's break-points don't match the specs
diff --git a/UI/WebServerResources/js/Common/sgColorPicker.directive.js b/UI/WebServerResources/js/Common/sgColorPicker.directive.js
new file mode 100644
index 000000000..acac31c2b
--- /dev/null
+++ b/UI/WebServerResources/js/Common/sgColorPicker.directive.js
@@ -0,0 +1,67 @@
+/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+(function() {
+ /* jshint validthis: true */
+ 'use strict';
+
+ /*
+ * sgColorPicker - Color picker widget
+ * @restrict element
+ * @param {function} sgOnSelect - the function to call when clicking on a color.
+ * One variable is available: color.
+ * @ngInject
+ * @example:
+
+
+ */
+ sgColorPicker.$inject = ['$parse'];
+ function sgColorPicker($parse) {
+ return {
+ restrict: 'E',
+ template: [
+ '',
+ ' ',
+ ' color_lens',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ''
+ ].join(''),
+ replace: true,
+ bindToController: true,
+ controller: sgColorPickerController,
+ controllerAs: '$sgColorPickerController',
+ link: link
+ };
+
+ function link(scope, iElement, iAttr, controller) {
+ // Associate callback to controller
+ controller.doSelect = $parse(iElement.attr('sg-on-select'));
+ }
+ }
+
+ /**
+ * @ngInject
+ */
+ sgColorPickerController.$inject = ['$scope', 'sgColors'];
+ function sgColorPickerController($scope, sgColors) {
+ var vm = this;
+
+ vm.colors = sgColors.selection;
+ vm.select = function(color) {
+ vm.doSelect($scope, { color: color });
+ };
+ }
+
+ angular
+ .module('SOGo.Common')
+ .directive('sgColorPicker', sgColorPicker);
+})();
diff --git a/UI/WebServerResources/scss/components/gridList/gridList.scss b/UI/WebServerResources/scss/components/gridList/gridList.scss
index ecf9ae677..b1f06b73f 100644
--- a/UI/WebServerResources/scss/components/gridList/gridList.scss
+++ b/UI/WebServerResources/scss/components/gridList/gridList.scss
@@ -1,5 +1,17 @@
@import "extends";
+// Color picker
+.sg-color-picker {
+ md-grid-tile {
+ border-radius: 25%;
+ &:hover,
+ &:active {
+ cursor: pointer;
+ transform: scale(1.5);
+ }
+ }
+}
+
// See sgToggleGrid directive
[sg-toggle-grid] {
md-grid-tile {