Filters
Applies a set of unique SVG filters. Best used with images, but also available to select components, such as Avatars.
import { filter } from '@brainandbones/skeleton';
Examples
Original
Emerald
BlueNight
XPro
Summer84
Rustic
Apollo
GreenFall
Noir
NoirLight
Usage
Import Filter Components
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 '@brainandbones/skeleton';
<Emerald />
<BlueNight />
You'll then need to apply the filter using one of the two techniques listed below.
Option 1: Use the Svelte Action
Use the following Svelte action to to filter any element.
<img src={myImageSrc} use:filter={'BlueNight'}>
Option 2: Using Only CSS
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'})">
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.