dimanche 1 mars 2015

Subtract colors

I will try to explain my question with an example:



  1. Let's say we have a background colored in a shade of red (easy to find out - color picker)

  2. There is a semi-transparent element in front. It is colored blue but appears to be purple.

  3. Again the resulting purple shade is easy to find but is there a wayt to find/compute the semi transparent blue shade?


Given: rgb(100,0,0) + x = rgb(100,0,100)


Find: x = rgba(0,0,100,0.5)




My actual case:


Background:rgb(147,150,72), Element rgb(44,100,62)


background foreground




This is partially solved in this question for the sole case of white backgrounds, I am actually looking for a more general solution. I have tried to adapt the javascript code but I don't really understand how it is done or if a general solution is even possible. I might be able to code it myself is someone understand how it works and tells me. (if solved I will post solution here of course)


Links:






Aucun commentaire:

Enregistrer un commentaire