Configuring defaults
marker.js 2 comes with a number of defaults for things like default marker color, set of colors in the color picker, default and available line width options, etc. Obviously, you can change all of those.
Changing defaults
You can change all of the defaults via the MarkerArea.settings
property. All of the settings you can change can be found in the Settings class reference.
In the example below, we change the colors available in the color picker to just 3 options of red, green, and blue. And we set the default color used for rectangle borders, lines, text, etc. to be green.
markerArea.settings.defaultColorSet = ['red', 'green', 'blue'];
markerArea.settings.defaultColor = 'green';
IMPORTANT
When changing the default color set make sure you adjust all of the default colors (like defaultFillColor, defaultHighlightColor, etc.) so that none of those colors are "orphaned" and aren't available in the color set. Otherwise, users may not be able to return to the original color after changing it in the color picker.
See also
- Settings class reference for all of the configurable defaults.