The image banner doesn't need much alteration. Mainly, we'll want to make all the text white because the overlay over the background image is dark. However, this isn't actually part of our theme, rather this should be a feature of our component itself. By that I mean if we change the color of our overlay to be a lighter color, the text in the caption should turn dark and vice versa.
For this we're going to use the built-in lightness
function in Sass to check if the lightness is above or below 50% and make the text white if the overlay is dark or black if the overlay is light. To do this we'll create a function called abs-contrast-color
.
First, create a file in scss/helpers/functions and call it _abs-contrast-color.scss. Inside that file we'll write our function:
@function abs-contrast-color($color) { @if (type-of($color) == color) { @if (lightness($color) <= 50%) { @return white; } @else { @return black...