Under default Android theme I have three custom colored buttons by means of
button.getBackground().setColorFilter(customColor, PorterDuff.Mode.MULTIPLY);
buttons http://img94.imageshack.us/img94/1723/themew.jpg
When I switch to Theme.Holo by means of /values-v11/styles.xml
<style name="Theme" parent="android:Theme.Holo">
colors are changed to:
http://img710.imageshack.us/img710/1659/themeholo.jpg
As I suspect, color of default button was changed in the new Holo Theme and being transformed with the same transformation parameter it gives unexpected colors. I would like to preserve initial colors. For this purpose I have to know transformation rules of PorterDuff.Mode.MULTIPLY. All that I have from Android docs is
[Sa * Da, Sc * Dc]
What does it means? Probably, S is a point of source bitmap (button drawable button.getBackground()) and D is a "point" of my customColor... How can I reproduce new transformed color from this formula? Does it means that new color N is:
[Na, Nr, Ng, Nb] = [Sa * Da, Sr * Dr, Sg * Dg, Sb * Db]
or what!?
UPDATE: I suppose that:
btn_default_normal.9.png was used for above buttons in simple Android Theme
btn_default_normal_holo_dark.9.png is used for Android Holo Theme
To fix a problem with colors under Holo Theme, I want to make intermediate transformation from the second (Holo) color #66999999 to the first color #F2E1E1E1:
button.getBackground().setColorFilter(some_Intermediate_Color, PorterDuff.Mode.MULTIPLY);
and then applay the same transformation as I have used before the new Holo theme was introduced. To calculate this intermediate color I have to solve two Diophantine equations in hexadecimal system where Na, Nc are in the interval [0, FF] and m, n - are integers:
66*Na = F2 + 100*m; => Na = 23
99*Nc = E1 + 100*n; => Nc = 89
Therefore, intermediate color is #23898989.
Unfortunately, implementing obtained intermediate color I still do not get desired colors as a result... Where am I wrong?
In this case, the source is customColor and the destination is the button's background. Your formula is correct though.