Just Blue
Just Blue
I tried to match my icons to my background.
Not really satisfied yet.
Anyway I thought I would share it.
The last image shows the icons on my phone which don’t work out well ATM.
]]>
< ![CDATA[
var items=LL.getEvent().getContainer().getItems();
var a=0;
f();
function f()
{
if(a
{
var item=items.getAt(a);
if(item.getType()==”Shortcut”)
{
var image=item.getDefaultIcon();
var bitmap=image.getBitmap();
bitmap=bitmap.copy(bitmap.getConfig(),true);
var width=bitmap.getWidth();
var height=bitmap.getHeight();
for(var x=0;x
{
for(var y=0;y
{
var pixel=bitmap.getPixel(x,y);
var red=Color.red(pixel);
var green=Color.green(pixel);
var blue=Color.blue(pixel);
m=(red+green+blue)/3;
if(m<150||!isGrey(pixel))
bitmap.setPixel(x,y,Color.argb(Color.alpha(pixel),m/4,m/4,m));
}
}
var newImg=LL.createImage(bitmap.getWidth(),bitmap.getHeight());
newImg.draw().drawBitmap(bitmap,0,0,new Paint());
newImg.update();
item.setCustomIcon(newImg);
}
a++;
setTimeout(f,0);
}
}
function isGrey(color)
{
return (Math.abs(Color.red(color)-Color.green(color))<32&& Math.abs(Color.red(color)-Color.blue(color))<32);
}
]]>
< ![CDATA[
Maybe try this:
http://developer.android.com/reference/android/graphics/Paint.html#setColorFilter%28android.graphics.ColorFilter%29
with agument:
new PorterDuffColorFilter(your_color, Mode.MULTIPLY)
when drawing the original bitmap into a new one.
]]>
< ![CDATA[
This would turn the whole icon blue, but I want to leave white as white.
]]>