This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Dear Readers, I am using a program that allows the user to input two colors, one a Foreground color and the other a Background color. The program outputs whether the two colors have sufficient "color difference" and sufficient "brightness difference". If both conditions are fulfilled then these colors can be used as Foreground and Background colors. I analyzed the outputs for different inputs and found the algorithm that the program used to calculate the "color difference". I tried to do the same to find the algorithm used to calculate the "brightness difference". But in vain! Does anybody know how to calculate the brightness difference? I need this because I want to make a Java program that takes in a color input and outputs all the possible colors that can be used in combination with the input color.