i forgot
This commit is contained in:
parent
30f2b4714d
commit
0c9f7a7822
21 changed files with 1868 additions and 1839 deletions
|
|
@ -4,57 +4,57 @@
|
|||
*/
|
||||
|
||||
interface TintedImageProps {
|
||||
src: string;
|
||||
colour: string;
|
||||
[key: string]: any;
|
||||
src: string;
|
||||
colour: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export default function TintedImage({
|
||||
colour,
|
||||
src,
|
||||
...props
|
||||
colour,
|
||||
src,
|
||||
...props
|
||||
}: TintedImageProps) {
|
||||
return (
|
||||
<svg
|
||||
width="100%"
|
||||
height="100%"
|
||||
{...props}
|
||||
>
|
||||
<defs>
|
||||
<filter
|
||||
id="tint"
|
||||
x="0%"
|
||||
y="0%"
|
||||
width="100%"
|
||||
height="100%"
|
||||
colorInterpolationFilters="sRGB"
|
||||
>
|
||||
<feColorMatrix
|
||||
type="saturate"
|
||||
values="0"
|
||||
result="grayscale"
|
||||
/>
|
||||
<feFlood flood-color={colour} result="tint" />
|
||||
<feComposite
|
||||
in="tint"
|
||||
in2="grayscale"
|
||||
operator="arithmetic"
|
||||
k1="1"
|
||||
k2="0"
|
||||
k3="0"
|
||||
k4="0"
|
||||
/>
|
||||
</filter>
|
||||
</defs>
|
||||
<image
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
filter={`url(#tint)`}
|
||||
href={src}
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
return (
|
||||
<svg
|
||||
width="100%"
|
||||
height="100%"
|
||||
{...props}
|
||||
>
|
||||
<defs>
|
||||
<filter
|
||||
id="tint"
|
||||
x="0%"
|
||||
y="0%"
|
||||
width="100%"
|
||||
height="100%"
|
||||
colorInterpolationFilters="sRGB"
|
||||
>
|
||||
<feColorMatrix
|
||||
type="saturate"
|
||||
values="0"
|
||||
result="grayscale"
|
||||
/>
|
||||
<feFlood flood-color={colour} result="tint" />
|
||||
<feComposite
|
||||
in="tint"
|
||||
in2="grayscale"
|
||||
operator="arithmetic"
|
||||
k1="1"
|
||||
k2="0"
|
||||
k3="0"
|
||||
k4="0"
|
||||
/>
|
||||
</filter>
|
||||
</defs>
|
||||
<image
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
filter={`url(#tint)`}
|
||||
href={src}
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue