| |
ChiefGoFor |
Posted: Wed Oct 24, 2007 3:59 pm Post subject: Solution for white text on light colored buttons |
|
|
|
Here is my solution for white text on light colored buttons. The function analyzes what color has been selected as the background color and decides if it should use white text or black text.
Here is the code: http://www.chiefgofor.com/get_button_image.zip
This file contains basic PHP code, so reading and understanding it should not be an issue.
Just unzip and upload to a server that has PHP installed and then run the index.php file to see it in action.
The function is being called for the 216 web safe colors. It should show you a broad example of the color spectrum.
The threshold should be throttled to your liking. Any average over the threshold will have black text, and average under the threshold will have white text.
The parameters should be self explanatory. The function may need to be tweaked as the code that I was looking at was from the 2005 version.
Please let me know if you have any questions. Thanks!
Last edited by ChiefGoFor on Thu Oct 25, 2007 2:32 pm; edited 1 time in total |
|
| |
|
 |
Ben |
Posted: Thu Oct 25, 2007 12:32 am Post subject: |
|
|
|
Thanks Chief that's fantastic!
Just to clarify for others, when you have a light coloured project colour (e.g. yellow) the light grey background on the button makes it hard to make out the save button, this code seeks to fix that issue.
Great to see this forum starting to kick off, if anyone else has any other mods they'd like to share by all means post them up here. |
|
| |
|
 |