Skip to content

Commit

Permalink
use computed background style if colorToRgb fails
Browse files Browse the repository at this point in the history
fixes #2635
  • Loading branch information
csachs committed Apr 11, 2021
1 parent 290c251 commit d1f6e6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/controllers/backgrounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1f6e6c

Please sign in to comment.