slots-lite draws a slot machine by code. One call returns an SVG string — in Node at build time or in the browser — so a static site gets its hero art with no script on the page. seed spins the reels and shapes the cabinet; brand spins the colours: one hex, the whole machine — a red seven, a gold bell, paper reels and a cabinet in your brand's main colour. A procedural slot machine in SVG with zero dependencies, under 8 KB gzipped.
What it draws
- The machine —
Slots.machine(): seeded reels and cabinet, three to five reels, three rows or the payline alone (rows: 1). The cabinet has a flat, arch or crown top, a marquee ringed by bulbs, a tray and a lever, patterned with the family's trigon, hex or octagon lattice. - Nine symbols of two kinds — classic and procedural symbols: six classic ones (seven, bar, bell, cherry, lemon, plum) and three drawn fresh by the seed (gem, star, coin).
classic: falsedraws the procedural three only, and the output then carries no fixed path at all.Slots.symbol()draws one symbol as an icon. - Results — a picture, never a game —
jackpot,three,bars,cherriesandmixedname what the payline shows, and the library builds it. It never decides a win, pays, weights a reel by odds or keeps any state.symbolspins exact cells.
How to use it
Install with npm install @spintax/slots-lite. A <script> gets the global Slots, Node and bundlers get module.exports, and slots.d.ts ships the types. At build time Slots.machine({ seed: 'example.com', brand: '#7c5cff' }) returns markup to inline; in the browser Slots.init('#hero-art', { seed: 42, motion: 'spin' }) draws into an element. motion: 'spin' spins the reels once as CSS inside the SVG, stopping left to right; under prefers-reduced-motion: reduce the machine is shown at rest from the start.
Colour
Each brand colour is captured by the symbol colour nearest its hue — red (the seven and the cherries), gold (bell, lemon, star, coin, the bulbs), violet or green — and the roles left unclaimed keep their classic hue, tinted toward your brand, except gold, which is never tinted. The result is a brand-aware classic palette, and the first brand colour left over paints the cabinet. The reels stay paper and the bar stays black in both themes; under theme: 'light' the cabinet defaults to line art. Any role can be pinned with any CSS colour, including a custom property.
Licence and stability
The output for a given seed and options is byte-identical, and changing the colours moves no symbol. Within a minor version the output does not change. A three-reel machine is 5.8–8.7 KB of SVG, 1.5–2.1 KB gzipped. MIT © 301ST, made for spintax.net.