CSS - Add Color to Black & White PNG Image Using a Filter -
everybody.
is possible in css add color black & white image using filter? i'm talking using filters it's possible in photoshop, , better example ones in microsoft powerpoint.
what i'm trying this: have image file of black icon. want add filter such in image (the background transparent) have color choose using filter, such i'd able have icon in whatever color want. said in title, it's png image, far know, can't use svg filters.
how can this? i'm trying write theme website using original icons, , i'm stuck on this.
update: want use original png images. i'm not going replace them svgs, or pre-edited pngs.
thanks lot in advance!
you can css filters, though wouldn’t recommend @ all:
.colorizable { filter: /* demonstration purposes; originals not entirely black */ contrast(1000%) /* black white */ invert(100%) /* white off-white */ sepia(100%) /* off-white yellow */ saturate(10000%) /* whatever want yellow */ hue-rotate(90deg); } .example-clip { display: block; height: 20px; margin: 1em; object-fit: none; object-position: 0 0; width: 300px; } .original { filter: contrast(1000%); } body { background: #333; }
<img class="colorizable example-clip" src="https://cdn.sstatic.net/sites/stackoverflow/img/wmd-buttons.svg" /> <img class="original example-clip" src="https://cdn.sstatic.net/sites/stackoverflow/img/wmd-buttons.svg" />
Comments
Post a Comment