npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

adobe-ase

v1.0.0

Published

A TypeScript library for reading and writing Adobe Swatch Exchange (.ase) files

Downloads

7

Readme

Adobe-ASE

A TypeScript library for reading and writing Adobe Swatch Exchange (.ase) files.

CI npm version License: MIT

Features

  • Read ASE files and parse color swatches
  • Write ASE files from color data
  • Full TypeScript support with type definitions
  • Support for multiple color models:
    • RGB (with hex conversion)
    • CMYK (with hex conversion)
    • Grayscale
    • LAB
  • Support for color groups
  • Support for color types (global, spot, normal)
  • Zero dependencies
  • Fully tested

Installation

npm install adobe-ase

Usage

Reading ASE Files

import { readAse } from 'adobe-ase';
import { readFileSync } from 'fs';

// Read ASE file
const buffer = readFileSync('colors.ase');
const swatches = readAse(buffer);

// Iterate through colors and groups
swatches.forEach((item) => {
  if (item.type === 'color') {
    console.log(`Color: ${item.name}`);
    console.log(`Model: ${item.color.model}`);

    if (item.color.model === 'RGB') {
      console.log(`RGB: ${item.color.r}, ${item.color.g}, ${item.color.b}`);
      console.log(`Hex: ${item.color.hex}`);
    }
  } else if (item.type === 'group') {
    console.log(`Group: ${item.name}`);
    item.entries.forEach((color) => {
      console.log(`  - ${color.name}`);
    });
  }
});

Writing ASE Files

import { writeAse } from 'adobe-ase';
import { writeFileSync } from 'fs';
import type { AseStructure } from 'adobe-ase';

// Create color structure
const swatches: AseStructure = [
  {
    type: 'color',
    name: 'Red',
    color: {
      model: 'RGB',
      r: 255,
      g: 0,
      b: 0,
      type: 'normal',
    },
  },
  {
    type: 'color',
    name: 'Green',
    color: {
      model: 'RGB',
      r: 0,
      g: 255,
      b: 0,
      type: 'normal',
    },
  },
  {
    type: 'group',
    name: 'Blues',
    entries: [
      {
        type: 'color',
        name: 'Light Blue',
        color: {
          model: 'RGB',
          r: 173,
          g: 216,
          b: 230,
          type: 'normal',
        },
      },
      {
        type: 'color',
        name: 'Dark Blue',
        color: {
          model: 'RGB',
          r: 0,
          g: 0,
          b: 139,
          type: 'normal',
        },
      },
    ],
  },
];

// Write to buffer
const buffer = writeAse(swatches);

// Save to file
writeFileSync('my-colors.ase', buffer);

Working with Different Color Models

RGB Colors

const rgbColor: AseStructure = [
  {
    type: 'color',
    name: 'Purple',
    color: {
      model: 'RGB',
      r: 128,
      g: 0,
      b: 128,
      type: 'normal',
    },
  },
];

const buffer = writeAse(rgbColor);
const parsed = readAse(buffer);

// Hex value is automatically calculated when reading
console.log(parsed[0].color.hex); // "#800080"

CMYK Colors

const cmykColor: AseStructure = [
  {
    type: 'color',
    name: 'Process Cyan',
    color: {
      model: 'CMYK',
      c: 100,
      m: 0,
      y: 0,
      k: 0,
      type: 'spot',
    },
  },
];

Grayscale Colors

const grayColor: AseStructure = [
  {
    type: 'color',
    name: 'Medium Gray',
    color: {
      model: 'Gray',
      gray: 0.5, // 0-1 range
      type: 'normal',
    },
  },
];

LAB Colors

const labColor: AseStructure = [
  {
    type: 'color',
    name: 'Lab Color',
    color: {
      model: 'LAB',
      lightness: 50,
      a: 25,
      b: -25,
      type: 'normal',
    },
  },
];

Color Types

Colors can be classified as:

  • 'normal' - Regular color swatch
  • 'global' - Global color (affects all instances when changed)
  • 'spot' - Spot color (for printing)

Utility Functions

The library also exports utility functions for color conversion:

import { rgbToHex, cmykToHex } from 'adobe-ase';

// Convert RGB to hex
const hex1 = rgbToHex({ r: 255, g: 0, b: 0 }); // "#ff0000"

// Convert CMYK to hex (basic conversion without color profile)
const hex2 = cmykToHex({ c: 100, m: 0, y: 0, k: 0 }); // "#00ffff"

TypeScript Support

This library is written in TypeScript and includes full type definitions:

import type {
  AseStructure,
  ColorEntry,
  ColorGroup,
  Color,
  RGBColor,
  CMYKColor,
  GrayColor,
  LABColor,
  ColorType,
} from 'adobe-ase';

API Reference

readAse(buffer: Buffer): AseStructure

Reads and parses an ASE file from a Buffer.

Parameters:

  • buffer - Buffer containing ASE file data

Returns: Parsed structure containing colors and groups

Throws:

  • TypeError - If buffer is not a valid Buffer instance
  • Error - If file signature or version is invalid

writeAse(structure: AseStructure): Buffer

Writes an ASE file to a Buffer.

Parameters:

  • structure - Structure containing colors and groups to write

Returns: Buffer containing the ASE file data

Development

See CONTRIBUTING.md for development guidelines.

License

MIT

Credits

Based on the ASE format specification and inspired by existing ASE parsing implementations.