Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not too bright / not too dark colors #12

Open
ocombe opened this issue Jul 15, 2014 · 6 comments
Open

Not too bright / not too dark colors #12

ocombe opened this issue Jul 15, 2014 · 6 comments

Comments

@ocombe
Copy link

ocombe commented Jul 15, 2014

I'd like to be able to define a max brightness or darkness for the color generation.
If I want to put text over it, I want it to be easy to read, with a white or dark font.

I've implemented something like that using YIQ:

var yiq = ((rgb.r*299)+(rgb.g*587)+(rgb.b*114))/1000;
return (yiq >= 128) ? 'black' : 'white';

In this case I test the color generated to adapt the font color, but it would be better if I could generate only colors that are suitable for a dark font, or for a white font.

Another great article about it: http://24ways.org/2010/calculating-color-contrast/

@Fooidge
Copy link
Owner

Fooidge commented Jul 15, 2014

I actually already have something like this in the works :) check branch for contrast. Going to add levels to color generation as well.

Jordan Checkman

On Jul 15, 2014, at 10:42 AM, Olivier Combe [email protected] wrote:

I'd like to be able to define a max brightness or darkness for the color generation.
If I want to put text over it, I want it to be easy to read, with a white or dark font.

I've implemented something like that using YIQ:

var yiq = ((rgb.r_299)+(rgb.g_587)+(rgb.b*114))/1000;
return (yiq >= 128) ? 'black' : 'white';
In this case I test the color generated to adapt the font color, but it would be better if I could generate only colors that are suitable for a dark font, or for a white font.


Reply to this email directly or view it on GitHub.

@ocombe
Copy link
Author

ocombe commented Jul 15, 2014

Damn you're good, working on features before we ask them !
I'll wait for it then.

@Fooidge Fooidge closed this as completed Jul 21, 2014
@Fooidge
Copy link
Owner

Fooidge commented Jul 21, 2014

Oops accidentally closed.

@Fooidge Fooidge reopened this Jul 21, 2014
@Madd0g
Copy link

Madd0g commented Sep 25, 2014

I really hope schemes will support this. I wanted to use schemes as a background color generator, but every scheme variation of my very bright blue is dark and makes it impossible to put anything over it.

@Fooidge
Copy link
Owner

Fooidge commented Sep 25, 2014

That doesn't make sense, many of the schemes don't change the value of the resulting colors. They should be roughly as light as your blue.

Jordan Checkman

On Sep 25, 2014, at 4:10 AM, Madd0g [email protected] wrote:

I really hope schemes will support this. I wanted to use schemes as a background color generator, but every scheme variation of my very bright blue is dark and makes it impossible to put anything over it.


Reply to this email directly or view it on GitHub.

@Madd0g
Copy link

Madd0g commented Sep 25, 2014

@Fooidge - So sorry, you are correct, I was using the wrong starting color, I had the correct color in the css, but the wrong one in the variable, I was surprised at how different the demos and my own tests looked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants