w3c / fxtf-drafts

Mirror of https://hg.fxtf.org/drafts
https://drafts.fxtf.org/
Other
68 stars 49 forks source link

[filter-effects] tint() function #533

Open Secret-chest opened 9 months ago

Secret-chest commented 9 months ago

Link to the current spec.

Currently, webpage authors looking to change the image's colouring to a scale of a specific colour must combine the existing filters to approximate said colour or resort to overlays, JavaScript or other methods.

With this in mind, I propose a new filter function:

tint(map, amount)

where map is a <color> or <gradient> used to tint the image, and amount is a <number> or <percentage> used to blend the original with the filtered version, 1 being completely filtered, like it is with sepia().

Example

_Photo taken by me and available on https://commons.wikimedia.org/wiki/File:Muntii_Retezat_06.jpg under CC BY-SA. Processing done with GIMP._

First image is input, second is output, processed using this hypothetical value: filter: tint(linear-gradient(#0d7fb8, #ffe600), 100%)

original gradient

karip commented 9 months ago

There was already a proposal for recolor() shorthand, which looks quite similar to your tint() function. However, it doesn't have the gradient option.