briangonzalez / jquery.adaptive-backgrounds.js

🦎 A jQuery plugin for extracting the dominant color from images and applying the color to their parent.
http://briangonzalez.github.io/jquery.adaptive-backgrounds.js/
6.53k stars 454 forks source link

lumaclasses #19

Closed mrantonwinter closed 10 years ago

mrantonwinter commented 10 years ago

could you include a sample on how to use lumaclasses

not really an issue, but had to post this somewhere.

briangonzalez commented 10 years ago

The luma class is applied to the parent based on the YIQ value. If the YIQ value is < 128, it gets the dark luma class, and the opposite in the light case.

briangonzalez commented 10 years ago

Also, sorry for the delayed reply!

shangsunset commented 10 years ago

Hi,

so i want to change text color based on its background image. my approach right now is to use jQuery to test if an element hasClass('ab-light') or 'ab-dark'. however, the lumaclasses somehow cannot be detected as a normal class. so the if statement can never be triggered. please see below code attached. any suggestion? thanks!

        if ($('.fill').hasClass('ab-light')) {
            $('.top-menu-bar a').css('color', 'black');
            console.log('sdafasdfsdf');
        }
        else {
            $('.top-menu-bar a').css('color', 'white');
            console.log('darkkkkkk');

        }
briangonzalez commented 10 years ago

@shangsunset Can you create a Codepen demonstrating the issue? Or, point me in the direction of your demo?

shangsunset commented 10 years ago

Hi @briangonzalez this is a gist for some of the code i have the html is just a snippet of a django template. here is the project. main.js and index.html are in static/js folder and templates/photography folder.

thanks for your time!

shangsunset commented 10 years ago

@briangonzalez here is a screen shot screen shot 2014-07-17 at 1 29 00 am