A web-based recreation of the shop interface from the game Balatro, built with Svelte 5 and TypeScript. This project aims to replicate the visual style and feel of the original game, including pixel-perfect UI layouts and custom WebGL shaders.
BackgroundShader.svelte) that mimics the game's hypnotic background.CRTShader.svelte) that applies scanlines, chromatic aberration, distortion, and noise to the entire screen.game.ts) to manage money, hands, discards, ante, round, and inventory items.m6x11plus font for authentic retro typography.Clone the repository:
git clone <repository-url>
cd balatro
Install dependencies:
npm install
Start the development server:
npm run dev
Open your browser at http://localhost:5173.
This project includes a script to automate the fetching of game assets (images and data) from the Balatro Wiki.
The script scripts/import_assets.js parses HTML files located in the static/ directory (e.g., joikers.html, tarots.html), extracts item information (name, cost, description, image URL), downloads the images to static/images/, and generates TypeScript data files in src/lib/stores/.
If you need to refresh assets or import new ones:
joikers.html) in the static/ folder.node scripts/import_assets.js
The project uses raw WebGL within Svelte components to render shaders.
src/lib/components/BackgroundShader.svelte: Renders the background swirl. It uses static/shaders/background.fs logic ported to a string within the component.src/lib/components/CRTShader.svelte: Renders a full-screen overlay for the CRT effect. It uses static/shaders/CRT.fs logic.crt_intensity constant inside CRTShader.svelte to change the strength of the scanlines and distortion.This is a fan project created for educational purposes. All game assets (images, designs, names) are property of LocalThunk and Playstack. If you haven't played Balatro yet, go buy it on Steam!