Skip to content

Commit

Permalink
feat: be able to provide custom colors
Browse files Browse the repository at this point in the history
Using the `colorPicker.colors` configuration users can provide
custom colors to the extension. Not documented, as not advisable.

Closes #11
  • Loading branch information
nikku committed Dec 6, 2022
1 parent 43726b0 commit dfedd94
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions colors/ColorPopupProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ const COLORS = [ {
} ];


export default function ColorPopupProvider(popupMenu, modeling, translate) {
export default function ColorPopupProvider(config, popupMenu, modeling, translate) {
this._popupMenu = popupMenu;
this._modeling = modeling;
this._translate = translate;

this._colors = config && config.colors || COLORS;

this._popupMenu.registerProvider('color-picker', this);
}


ColorPopupProvider.$inject = [
'colorPicker',
'popupMenu',
'modeling',
'translate'
Expand All @@ -44,7 +47,7 @@ ColorPopupProvider.$inject = [
ColorPopupProvider.prototype.getEntries = function(element) {
var self = this;

var entries = COLORS.map(function(color) {
var entries = this._colors.map(function(color) {

return {
title: self._translate(color.label),
Expand Down

0 comments on commit dfedd94

Please sign in to comment.