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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ase-util

v1.0.3

Published

Utility library to handle Adobe Swatch Exchange (ASE) files

Downloads

259

Readme

ASE Util

Utility library to handle Adobe Swatch Exchange (ASE) files.

npm install ase-util

The package provides JavaScript functions and command line tools.

Command line tools

asedump

Dumps the colors and groups of an .ase file as JSON or LESS format.

Usage: asedump [options] filename.ase

Options:

  • --pretty Pretty print the output
  • --format / -f Output format: json, json-colors, less
    • json: output of ase.read as JSON (includes everything in the ASE file).
    • json-colors: a JSON that contains only color names and hex color values (groups are flattened, CMYK and LAB colors ignored).
    • less: like json-colors but the output is formatted using LESS syntax.
  • --export When using JSON output it adds the CommonJS module.exports

ase2clr

Converts an .ase file to .clr OSX color list.

OSX Only: To do the conversion the tool uses OSX scripting to get a NSColorList instance, in other words it'll not work on other platforms.

Usage: ase2clr input.ase output.clr

API

var ase = require("ase-util");

ase.read(buffer)

var fs = require("fs");
var result = ase.read(fs.readFileSync("myfile.ase"));

Reads a buffer with the ASE binary format; outputs an array with color or color group objects:

Color

There are four kinds of colors: RGB, CMYK, Lab, and Gray.

Color components in ASE files are stored using float values, for instance in RGB component values goes from 0 to 1 (instead of 0 to 255). For RGB and Gray colors, an convenient hex field with the HTML hex color format is included.

Each color value has a type field with the Spot/Process (Normal)/Process Global distinction made by Illustrator and InDesign (see https://helpx.adobe.com/illustrator/using/color.html).

RGB color example:

{
  type: 'color',
  name: 'Color Name',
  color: {model: 'RGB', r: 1, g: 0, b: 0, hex: 'FF0000', type: 'normal'}
}

CMYK color example:

{
  type: 'color',
  name: 'Color Name',
  color: {model: 'CMYK', c: 1, m: 0, y: 0, k: 0, type: 'spot'}
}

LAB color example:

{
  type: 'color',
  name: 'Color Name',
  color: {model: 'LAB', lightness: 1, a: 0, b: 0, type: 'normal'}
}

Gray color example:

{
  type: 'color',
  name: 'Color Name',
  color: {model: 'Gray', gray: 0, hex: '000000', type: 'normal'}
}

Group

Groups are named lists of colors:

{
  type: 'group',
  name: 'Group Name',
  entries: [] // Array of Colors
}

ase.formatAsLess(input, [nameEntryFormatFunction])

Takes the output of read and returns a string with LESS variable declarations for the colors.

Only colors with hex values are taken into account (CMYK/LAB colors are ignored).

Color names are formatted using nameEntryFormatFunction, if omitted Lodash's kebabCase will be used.

ase.formatAsColorsObject(input, [nameEntryFormatFunction])

Takes the output of read and returns a object with color names and color hex values.

The returned object is useful for contexts where you need only the color/value pairs, i.e. reading the ASE file to use it with PostCSS.

Only colors with hex values are taken into account (CMYK/LAB colors are ignored).

Color names are formatted using nameEntryFormatFunction, if omitted Lodash's kebabCase will be used.