3.0.0 • Published 11 months ago

@4bitlabs/color v3.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

@4bitlabs/color License NPM Version NPM Downloads

A collection color manipulation functions and predefined palettes for working with EGA/CGA images.

Palettes

Predefined Palettes

Palette
Palettes.CGA_PALETTEIBM's CGA Palette
Palettes.TRUE_CGA_PALETTEVileR's "True" CGA Palettte
Palette.DGA_PALETTEAdigun A. Polack's AAP-DGA16
Palette.COLLY_SOFT_PALETTEcollyflower05's SOFT CGA PALETTE

Using your own 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
);

Predefined Dither Pairs

MixPaletteMix
Dithers.CGACGAnone
Dithers.CGA_MIXCGA25% mix
Dithers.CGA_FLATCGA50% mix (SCUMMVM de-dithering)
Dithers.CGA_SOFTCGADynamic mix
Dithers.TRUE_CGATRUE-CGAnone
Dithers.TRUE_CGA_MIXTRUE-CGA25% mix
Dithers.TRUE_CGA_FLATTRUE-CGA50% mix (SCUMMVM de-dithering)
Dithers.TRUE_CGA_SOFTTRUE-CGADynamic mix

Generating your own Dither Pairs

import { generateSciDitherPairs, Mixers } from '@4bitlabs/color';

const pairs = generateSciDitherPairs(customPalette, Mixers.softMixer());

IBM 5153 Contrast Knob

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);

Simulating Grayscale

const grays = toGrayscale(Palettes.CGA_PALETTE);
3.0.0

11 months ago

2.1.4

1 year ago

2.1.5

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago