Skip to content

Instantly share code, notes, and snippets.

@corpix
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corpix/9633378 to your computer and use it in GitHub Desktop.
Save corpix/9633378 to your computer and use it in GitHub Desktop.
Recover color
(function(c,a,b,i,r){
r='#';
c=c.replace(r,'');
b=b.replace(r,'');
for(i=0;i<6;i+=2)
r+=Math.round(a*parseInt(c[i]+c[i+1],16)+(1-a)*parseInt(b[i]+b[i+1],16)).toString(16);
return r
})('#f4f3f0', 0.3, '#ffffff')
/* color, alpha, background */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment