Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@4bitlabs/color

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4bitlabs/color

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

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@4bitlabs/color License NPM Version NPM Downloads

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

Documentation

Full documentation for the library can be found here.

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 { Dithers, Mixers } from '@4bitlabs/color';

const pairs = Dithers.generatePairs(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);

FAQs

Package last updated on 30 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc