voidlabs / mosaico

Mosaico - Responsive Email Template Editor
https://mosaico.io
GNU General Public License v3.0
1.71k stars 504 forks source link

colorpicker: change default theme colors #238

Closed Smus closed 7 years ago

Smus commented 7 years ago

Is it possible to change the default colors for the color picker?

image

Smus commented 7 years ago

Nevermind, found them in evol.colorpicker.js :)

Smus commented 7 years ago

hmm or maybe not :-( That wasnt the correct place

bago commented 7 years ago

mosaico currently depends on evol colorpicker 3.2.1 and "embeds" evol 3.2.1 in the "compiled" output. evol colorpicker 3.2.1 doesn't support overriding the palette via configuration.

Newer colorpicker (https://github.com/evoluteur/colorpicker/blob/master/js/evol-colorpicker.js#L211) added support for "customTheme" option, but I didn't have time to check if the newer colorpicker is compatible with mosaico.

pbatroff commented 6 years ago

Hmm, is this solved? I need to do exactly this - add a custom palette with company colors. And can't really figure out if this is supposed to be a solution, or just stating it doesn't work.

francescbassas commented 5 years ago

+1 to this enhancement. Can it be reopened?

bago commented 5 years ago

Try declaring a custom color widget:

var colorWidgetPlugin = {
    widget: function($, ko, kojqui) {
      return {
        widget: 'color',
        html: function(propAccessor, onfocusbinding, parameters) {
          return '<input size="7" type="text" data-bind="colorpicker: { color: ' + propAccessor + ', customTheme: WHATYOUWANT, strings: $root.t(\'Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet.\') }, ' + ', ' + onfocusbinding + '" />';
        }
      };
    }
  };

The pass this plugin to the mosaico init. Let us know.

IProSoft commented 1 year ago

@bago could You share more specific example, where and how include plugin ?

bago commented 1 year ago

https://github.com/voidlabs/mosaico/wiki/Mosaico-Plugins