Skip to content
ShiloPublic

About

Full of pixels, not tools. A fast, minimalist pixel-art editor for the browser that shows only the controls you need, and embeds in any web app as a web component. https://pixiful.app https://shilo.github.io/pixiful

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

113 Commits

Folders and files

Repository files navigation

Pixiful

Full of pixels, not tools. A fast, minimalist pixel-art editor for the browser that shows only the controls you need, and embeds in any web app as a web component.

pixiful.app · Embedding guide · API reference

Install Pixiful from a version tag. To follow development, use npm install github:Shilo/pixiful#main.

What it does

  • Draw: pencil (pixel-perfect 1 px strokes, square/round brushes), eraser, fill (connected or every matching pixel), eyedropper, line/rectangle/ellipse (outline or filled, Shift to constrain, Alt from centre).
  • Select and transform: rectangle and same-colour selection, move with mouse or arrow keys, flip, rotate, crop to selection, cut/copy/paste (including images from the system clipboard).
  • Simple first: you can draw the moment it opens. A bright sheet of pixel paper, a row of colours under it, and a few quiet controls that show only what you need; everything else has a plain name and a one-line explanation when you ask for it. Light and dark themes, 44 px touch targets, two-finger tap to undo.
  • Layers: add, duplicate, delete, rename, reorder (drag or Alt+↑/↓), show/hide, lock, opacity, merge down.
  • Animation: frames, duplicate, reorder, per-frame timing, playback, live preview, onion skin; export animated GIF or a sprite sheet.
  • Colour: primary/secondary colours (right-click paints the secondary), HSV picker with alpha and hex, editable palette, load .hex and GIMP .gpl palettes and save .hex, palette from image.
  • Files: open PNG, GIF, JPEG, WebP (or drop them on the canvas); export PNG/GIF/sheet at 1–64× nearest-neighbour scale (within the browser's image limits); editable project files that keep layers and frames; autosave in the standalone app.
  • Unlimited-feeling undo with a memory budget: every action, including layer and frame changes.
  • Keyboard first: Aseprite-style shortcuts; press ? in the editor for the full sheet.

Use it in your app

Install a version tag from GitHub (npm, pnpm and Yarn all accept this form):

npm install github:Shilo/pixiful#vX.Y.Z   # replace vX.Y.Z with a version tag

The import name is pixiful. Pages without a build step can load a pinned release from jsDelivr. See the embedding guide.

The one-call version — opens a full-screen editor and gives you the result:

import { editImage } from "pixiful";

const result = await editImage(imageUrlOrBlob, { saveLabel: "Use this image" });
if (result) await upload(result.png);   // null if the user closed it

Embedded in your own layout, with your own storage:

import { createPixelEditor } from "pixiful";

const editor = await createPixelEditor(document.querySelector("#panel"), {
  width: 32,
  height: 32,
  onSave: async ({ png, project }) => { await fetch("/api/sprite", { method: "PUT", body: project }); },
});

Or as plain HTML:

<pixiful-editor src="sprite.png" save-label="Save" theme="light"></pixiful-editor>
<script type="module">
  import { definePixelEditor } from "pixiful";
  definePixelEditor();
  document.querySelector("pixiful-editor").addEventListener("save", (e) => {
    e.detail.waitUntil(upload(e.detail.png));
  });
</script>

Apps that own their structure and storage can drive the same editor through a typed host controller:

  • await editor.getController();
  • load layers, frames and native cels by your own keys;
  • set a policy (fixed structure, protected cels, allowed tools);
  • read and write exact RGBA;
  • add your own tool and overlays to the canvas, sharing one Undo with pixel edits;
  • save with tokens that acknowledge exactly what was captured.

See host controller and examples/host-controller/.

  • Loads only when needed: the entry is ≈3 KiB gzip; the editor (≈62 KiB gzip plus the ≈16 KiB core, zero runtime dependencies) downloads when an editor is first shown, and the host controller (≈8 KiB) only when asked for.
  • No backend, no account: your app owns storage; the editor only fetches image URLs you give it.
  • Works anywhere: vanilla JS, TypeScript, React, Vue, Svelte, static pages. Styles are isolated in Shadow DOM; theme with --pixiful-* CSS variables.

Guides: Embedding guide · API reference · Examples

Used by

  • PixelDoll: dresses up 2D game characters with swappable, frame-aligned equipment layers. It embeds Pixiful as its sprite editor through the host controller.

Using Pixiful in your app? See used by to add it.

Run the standalone editor

npm install
npm run dev          # http://localhost:5173
npm run build        # library → dist/, standalone app → dist-app/

dist-app/ is a static site with relative asset paths, so it also works from a subpath such as https://<user>.github.io/<repo>/. Once Pages is configured, passing builds from main publish the library and deploy the standalone editor to pixiful.app. The standalone app can be installed from your browser and opened offline after it downloads. See releasing.

Development

Command What it does
npm run typecheck Strict TypeScript check
npm test Unit tests (Vitest)
npm run test:e2e Browser tests of the built app in Chromium, Firefox and WebKit (run npm run build:app first)
npm run test:integration Packs the library, installs it into five fresh example apps plus a no-build static site, builds them and tests them in three browsers; checks Node imports of the root and /core entries
npm run size Checks the built package against the performance budget (run npm run build:lib first)
npx playwright test --config test/perf/playwright.config.ts Performance measurements → docs/performance/
npm run test:all All of the above

First time: npx playwright install chromium firefox webkit.

Project docs

Licence

MIT. The only third-party material is a vendored subset of Lucide icons (ISC); see THIRD_PARTY_NOTICES.md.

About

Full of pixels, not tools. A fast, minimalist pixel-art editor for the browser that shows only the controls you need, and embeds in any web app as a web component. https://pixiful.app https://shilo.github.io/pixiful

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages