diff --git a/CHANGELOG.md b/CHANGELOG.md index b44aadf8..b4faae3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### 3.8.0 + +* [fix] Fix shape hover colors when overlay uses named color (increaseBrightness() accepts names now) * [feat] Selected and hovered items (shapes, sources, ...) are rendered at last. * [feat] Add selectionLineWidth option for shapes and catalogs. * [fix] horizontal/vertical overlay lines appearing correctly diff --git a/src/js/Overlay.js b/src/js/Overlay.js index 2ab51a12..72ae6460 100644 --- a/src/js/Overlay.js +++ b/src/js/Overlay.js @@ -309,12 +309,15 @@ export let GraphicOverlay = (function() { * * @memberof GraphicOverlay * - * @param {string} hex - The color given in hexadecimal e.g. '#ffa0bb' + * @param {string} color - Any CSS color string (hex e.g. '#ffa0bb', rgb(), named color) * @param {number} percent - The percentage to increase the brightness of * * @returns {string} The new color given as an hexadecimal string */ - GraphicOverlay.increaseBrightness = function(hex, percent){ + GraphicOverlay.increaseBrightness = function(color, percent){ + // Normalize the color to hex. + var hex = Color.standardizeColor(color); + // strip the leading # if it's there hex = hex.replace(/^\s*#|\s*$/g, '');