https://github.com/mwh/dither3x
Generate accurate Windows 3.x dither patterns for any colour in-browser
https://github.com/mwh/dither3x
dithering javascript retrocomputing windows-3-x
Last synced: 12 months ago
JSON representation
Generate accurate Windows 3.x dither patterns for any colour in-browser
- Host: GitHub
- URL: https://github.com/mwh/dither3x
- Owner: mwh
- License: mit
- Created: 2024-12-31T21:47:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-01T23:53:05.000Z (over 1 year ago)
- Last Synced: 2025-05-07T08:50:47.664Z (about 1 year ago)
- Topics: dithering, javascript, retrocomputing, windows-3-x
- Language: JavaScript
- Homepage: https://mwh.nz/dither/
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Generate accurate Windows 3.x dither patterns for any solid colour
import dither from "./dither.js";
const dataURI = dither(128, 31, 190);
element.style.backgroundImage = `url(${dataURI})`;
The dither function takes an additional argument to specify the pixel
size (default 1). The resulting image will be (8 * px)x(8 * px).
Instead of three integer components, a seven-character #abcdef hex
colour specifier can be given as the first argument.
A `matrix` function is also exported, and returns an 8x8 array of hex
colour strings instead of an image.
The algorithm in use is adapted from expired US Patent 5485558, with
some corrections for bugs.
A live tool using this library is accessible at https://mwh.nz/dither/