Переглянути джерело

Merge pull request #2933 from csachs/hasDarkBackgroundNamedColor

Use computed background style if colorToRgb fails (fixes #2635)
Hakim El Hattab 4 роки тому
батько
коміт
444d127053
1 змінених файлів з 2 додано та 2 видалено
  1. 2 2
      js/controllers/backgrounds.js

+ 2 - 2
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;