reveal.js
reveal.js copied to clipboard
Fix light/dark bakground detection for backgrounds specified with hsl()
Adds support for HSL(A) colors to the color parsing code.
Previously with the default theme, a light HSL-specified background did not change the text color to dark, making the text unreadable.
You can see the problem that this pull request fixes with the following slide, and the default theme:
<section data-background-color="hsl(0, 30%, 100%)">Slide 1</section>
The README states, "All CSS color formats are supported, including hex values, keywords, rgba() or hsl()".
Thanks for the PR!
From some quick testing in Chrome/FF I think getComputedStyle(...).backgroundColor
is always in rgb/rgba format, even if the color was specified in hsl. Maybe instead of adding a hsl parser, we could read the rgb color from the background element that way? Will need to experiment a bit more.