WordPress.org

Ready to get started?Download WordPress

Forums

Supersized full screen background - change font color for different background (2 posts)

  1. Phartog
    Member
    Posted 1 year ago #

    Hello everybody,

    I have installed the supersized full screen background plugin. I like it very much, but sometimes the background is very light and my text is white, so I cannot read the text (and vice versa). Does anybody know a way to change the font color for each background image???

    Thanks in advance!

  2. Phartog
    Member
    Posted 1 year ago #

    If fount a bit of code on how to measure the brightness of the background and how to give back a light or dark tag, does anybody have any idea how to use this for what I want????

    var darkOrLight = function(red, green, blue) {
      var brightness;
      brightness = (red * 299) + (green * 587) + (blue * 114);
      brightness = brightness / 255000;
    
      // values range from 0 to 1
      // anything greater than 0.5 should be bright enough for dark text
      if (brightness >= 0.5) {
        return "dark";
      } else {
        return "light";
      }
    }

Topic Closed

This topic has been closed to new replies.

About this Topic