From d1f6e6cce962007a468bbf6631daf8ae1457fcb6 Mon Sep 17 00:00:00 2001 From: Christian Sachs Date: Sun, 11 Apr 2021 13:25:36 +0200 Subject: [PATCH] use computed background style if colorToRgb fails fixes #2635 --- js/controllers/backgrounds.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/controllers/backgrounds.js b/js/controllers/backgrounds.js index e8cc996..0e58df5 100644 --- a/js/controllers/backgrounds.js +++ b/js/controllers/backgrounds.js @@ -192,8 +192,8 @@ export default class Backgrounds { // color, no class will be added let contrastColor = data.backgroundColor; - // If no bg color was found, check the computed background - if( !contrastColor ) { + // If no bg color was found, or it cannot be converted by colorToRgb, check the computed background + if( !contrastColor || !colorToRgb( contrastColor ) ) { let computedBackgroundStyle = window.getComputedStyle( element ); if( computedBackgroundStyle && computedBackgroundStyle.backgroundColor ) { contrastColor = computedBackgroundStyle.backgroundColor;