Filters
Svelte ActionApplies a set of unique SVG filters. Best used with images, but also available to select components, such as Avatars.
Import
Package
Source
Docs
Examples
Original
Emerald
BlueNight
XPro
Summer84
Rustic
Apollo
GreenFall
Noir
NoirLight
Usage
Import SVG Filters
Add within scope of your filtered element. For global scope, add the following to your app's root component. Only import the filters you plan to use.
import { Emerald, BlueNight, /* ... */ } from '@skeletonlabs/skeleton';
<Emerald />
<BlueNight />
Applying a Filter
Use of of the two menthods below to apply your desired filter.
Via the Svelte Action
Use the following Svelte action to to filter any element.
<img src={myImageSrc} use:filter={'BlueNight'}>
Via Style Attribute
Alternatively you may apply filters using CSS. This is what the action does for you. Note the hash mark is required.
<img src={myImageSrc} style="filter: url({'#Emerald'})">
Create a Filter
Easily generate your own filters using this tool by Rik Schennink.
Browser Support
Please be aware that browser support varies. Some filters are not functional in Safari, while Firefox is not supported at all. We recommend using progressive enhancement when using filters in non-supported browsers.