diff --git a/js/reveal.js b/js/reveal.js index df4e8a0..24093e4 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -714,15 +714,16 @@ if( data.backgroundPosition ) element.style.backgroundPosition = data.backgroundPosition; if( data.backgroundTransition ) element.setAttribute( 'data-background-transition', data.backgroundTransition ); + container.appendChild( element ); + // If this slide has a background color, add a class that // signals if it is light - if( element.style.backgroundColor && colorBrightness( element.style.backgroundColor ) > 128 ) { + var computedBackgroundColor = window.getComputedStyle( element ).backgroundColor; + if( computedBackgroundColor && colorBrightness( computedBackgroundColor ) > 128 ) { slide.classList.add( 'is-background-light' ); element.classList.add( 'is-background-light' ); } - container.appendChild( element ); - return element; } diff --git a/test/examples/slide-backgrounds.html b/test/examples/slide-backgrounds.html index ba020cb..60223c7 100644 --- a/test/examples/slide-backgrounds.html +++ b/test/examples/slide-backgrounds.html @@ -10,6 +10,15 @@ + @@ -26,6 +35,10 @@

data-background: #bb00bb

+
+

data-background: ----

+
+

data-background: #ff0000

@@ -50,20 +63,20 @@
-
+

Background image

-
+

Background image

-
+

Background image

-
+

Background image

data-background-size="100px" data-background-repeat="repeat" data-background-color="#111"