A collection color manipulation functions and predefined palettes for working with EGA/CGA images.
Full documentation for the library can be found here.
Palette | |
---|---|
Palettes.CGA_PALETTE |
IBM's CGA Palette |
Palettes.TRUE_CGA_PALETTE |
VileR's "True" CGA Palettte |
Palette.DGA_PALETTE |
Adigun A. Polack's AAP-DGA16 |
Palette.COLLY_SOFT_PALETTE |
collyflower05's SOFT CGA PALETTE |
const customPalette = Uint32Array.of(
//AA-BB-GG-RR
0xff_1f_1f_1f, // color 0
/* ... */
/* snip 14 more entries */
/* ... */
0xff_e0_e0_e0, // color 15
);
Mix | Palette | Mix |
---|---|---|
Dithers.CGA |
CGA | none |
Dithers.CGA_MIX |
CGA | 25% mix |
Dithers.CGA_FLAT |
CGA | 50% mix (SCUMMVM de-dithering) |
Dithers.CGA_SOFT |
CGA | Dynamic mix |
Dithers.TRUE_CGA |
TRUE-CGA | none |
Dithers.TRUE_CGA_MIX |
TRUE-CGA | 25% mix |
Dithers.TRUE_CGA_FLAT |
TRUE-CGA | 50% mix (SCUMMVM de-dithering) |
Dithers.TRUE_CGA_SOFT |
TRUE-CGA | Dynamic mix |
import { Dithers, Mixers } from '@4bitlabs/color';
const pairs = Dithers.generatePairs(customPalette, Mixers.softMixer());
import { IBM5153Contrast } from '@4bitlabs/color';
// Simulate turning the constrast knob on a IBM-5153 to about 50%
const palette = IBM5153Contrast(Palettes.CGA_PALETTE, 0.5);
const grays = toGrayscale(Palettes.CGA_PALETTE);