├── .gitignore ├── LICENSE ├── README.md ├── ase2json.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Marco Lehmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ase2json 2 | ======== 3 | 4 | Adobe Swatch Exchange (ASE) to JSON Converter 5 | 6 | Usage: 7 | 8 | $ node ase2json.js .ase 9 | 10 | This generates a json file named `` in the same folder. -------------------------------------------------------------------------------- /ase2json.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Adobe Swatch Exchange (ASE) to JSON Converter 3 | * Copyright © Marco Lehmann 2014 4 | * 5 | * File Format: http://www.selapa.net/swatches/colors/fileformats.php#adobe_ase 6 | */ 7 | 8 | 9 | // require modules 10 | var util = require('util'), 11 | path = require('path'), 12 | fs = require('fs'), 13 | binary = require('binary'); 14 | 15 | 16 | // read arguments 17 | var file = (process.argv[2]) ? process.argv[2] : null; 18 | if (file == null) { 19 | return console.error('ERROR: no ASE file given\nUSAGE: node ase2json.js file.ase'); 20 | } 21 | 22 | 23 | // signature 24 | const SIGNATURE = 'ASEF'; 25 | 26 | // block types 27 | const BT_GROUP_START = new Buffer([0xC0, 0x01]); 28 | const BT_GROUP_END = new Buffer([0xc0, 0x02]); 29 | const BT_COLOR_ENTRY = new Buffer([0x00, 0x01]); 30 | 31 | // color modes 32 | const CM_CMYK = 'CMYK'; 33 | const CM_RGB = 'RGB'; 34 | const CM_LAB = 'LAB'; 35 | const CM_GRAY = 'Gray'; 36 | 37 | // color types 38 | const CT_GLOBAL = 0; 39 | const CT_SPOT = 1; 40 | const CT_NORMAL = 2; 41 | 42 | 43 | // swap bytes from big-endian to little-endian 44 | var swapBytes = function(buffer) { 45 | var l = buffer.length; 46 | if (l & 0x01) { 47 | throw new Error('Buffer length must be even'); 48 | } 49 | for (var i=0; i", 7 | "license": "MIT", 8 | "dependencies": { 9 | "binary": "0.3.0" 10 | }, 11 | "repository": { 12 | "url": "https://github.com/m99coder/ase2json.git" 13 | }, 14 | "engines": { 15 | "node": "*" 16 | } 17 | } 18 | --------------------------------------------------------------------------------