diff --git a/website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js b/website_mail_snippet_bg_color/static/src/js/bg_color_picker.js similarity index 70% rename from website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js rename to website_mail_snippet_bg_color/static/src/js/bg_color_picker.js index 15a76c0c..2f3a0022 100644 --- a/website_mail_snippet_bg_color/static/src/js/bg_color_chooser.js +++ b/website_mail_snippet_bg_color/static/src/js/bg_color_picker.js @@ -24,12 +24,22 @@ }, change: function(color) { + var oldcolor = this.$target.css("background-color"), + sides = ["top", "bottom", "left", "right"]; this.$target.css("background-color", color); // Old-school bgcolor attribute if the element already had one if (this.$target.attr("bgcolor")) { this.$target.attr("bgcolor", color); } + + // Match border colors if it was the same + for (var n in sides) { + var property = "border-" + sides[n] + "-color"; + if (this.$target.css(property) == oldcolor) { + this.$target.css(property, color); + } + } }, }); })(jQuery);