Install
createSubscriber from svelte/reactivity (available since 5.7.0).
createLogoSoup
The Svelte adapter exposes acreateLogoSoup function that returns a reactive object. Reading its properties inside an $effect or template automatically subscribes to state changes.
Reactive Properties
The object returned bycreateLogoSoup() exposes these reactive getters:
| Property | Type | Description |
|---|---|---|
state | LogoSoupState | Raw state snapshot from the engine |
isLoading | boolean | true while images are being loaded |
isReady | boolean | true when normalization is complete |
normalizedLogos | NormalizedLogo[] | The processed logos |
error | Error | null | Set if all images fail to load |
| Method | Description |
|---|---|
process(options) | Trigger a processing run with new options |
destroy() | Clean up blob URLs and cancel in-flight work |
Reactive Options
Since$effect auto-tracks any reactive state ($state, $derived, $props) read inside it, changing any option value automatically re-triggers processing:
Dark Mode with Background Color
When displaying logos on a dark background, passbackgroundColor so Logo Soup can properly detect contrast and apply irradiation compensation:
Visual Center Alignment
Apply visual center alignment with thegetVisualCenterTransform helper from the core package:
translate(0px, -2.3px) or undefined if no offset is needed.
Reusable Component
Wrap it in a reusable Svelte component:How It Works Under the Hood
The Svelte adapter usescreateSubscriber from svelte/reactivity (5.7+) to bridge the core engine’s subscribe/getSnapshot interface into Svelte’s runes-based reactivity:
createSubscriberreturns a function that, when called inside a reactive context ($effect, template expression,$derived), registers the caller as a subscriber- Each getter (
isReady,normalizedLogos, etc.) callssubscribe()before reading from the engine, making it automatically reactive - The engine itself is not duplicated into
$state— it remains the single source of truth, withcreateSubscriberacting as the bridge - No legacy store contract (
$:orsubscribemethod) is used — this is pure Svelte 5 runes