Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How do I automatically set a foreground colour based upon a background colour?

Avatar of drunken_elf
drunken_elf asked on
JavaScript
6 Comments1 Solution335 ViewsLast Modified:
I need a function that will automatically choose white or black text based upon a background colour, so its readable (white on yellow is not, for example). It is for a member profile option I am creating on a website, where users can choose a base colour for their profile and depending on that colour it will set white or black text.

Any help would be great, thanks.
ASKER CERTIFIED SOLUTION
Avatar of hankknight
hankknightFlag of Canada image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers