mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Make getHoverColor() return the original value if it is CanvasGradient (#5865)
This commit is contained in:
parent
f5437fe548
commit
241499d27f
@ -647,7 +647,7 @@ module.exports = function() {
|
||||
|
||||
helpers.getHoverColor = function(colorValue) {
|
||||
/* global CanvasPattern */
|
||||
return (colorValue instanceof CanvasPattern) ?
|
||||
return (colorValue instanceof CanvasPattern || colorValue instanceof CanvasGradient) ?
|
||||
colorValue :
|
||||
helpers.color(colorValue).saturate(0.5).darken(0.1).rgbString();
|
||||
};
|
||||
|
@ -848,6 +848,13 @@ describe('Core helper tests', function() {
|
||||
};
|
||||
});
|
||||
|
||||
it('should return a CanvasGradient when called with a CanvasGradient', function() {
|
||||
var context = document.createElement('canvas').getContext('2d');
|
||||
var gradient = context.createLinearGradient(0, 1, 2, 3);
|
||||
|
||||
expect(helpers.getHoverColor(gradient) instanceof CanvasGradient).toBe(true);
|
||||
});
|
||||
|
||||
it('should return a modified version of color when called with a color', function() {
|
||||
var originalColorRGB = 'rgb(70, 191, 189)';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user