chromaticity-color-utilities
Advanced tools
Comparing version 0.13.2-alpha to 0.14.0-alpha
@@ -139,2 +139,2 @@ import * as Colors from './Colors'; | ||
} | ||
export = Blend; | ||
export default Blend; |
@@ -43,2 +43,3 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Colors = __importStar(require("./Colors")); | ||
@@ -405,2 +406,2 @@ var Convert_1 = __importDefault(require("./Convert")); | ||
}()); | ||
module.exports = Blend; | ||
exports.default = Blend; |
@@ -675,5 +675,9 @@ "use strict"; | ||
} | ||
else { | ||
args.method = args.method.toLowerCase().replace(/[^a-z]/, ''); | ||
} | ||
var colorString; | ||
switch (args.method) { | ||
case 'hex': | ||
case 'hexidecimal': | ||
var hex = this.to('hex'); | ||
@@ -680,0 +684,0 @@ colorString = "#".concat(hex.getHex()); |
@@ -444,2 +444,2 @@ import * as Colors from './Colors'; | ||
} | ||
export = Convert; | ||
export default Convert; |
@@ -97,2 +97,2 @@ import * as Colors from './Colors'; | ||
} | ||
export = Harmony; | ||
export default Harmony; |
@@ -43,2 +43,3 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Modify_1 = __importDefault(require("./Modify")); | ||
@@ -555,2 +556,2 @@ var Blend_1 = __importDefault(require("./Blend")); | ||
}()); | ||
module.exports = Harmony; | ||
exports.default = Harmony; |
@@ -1,3 +0,44 @@ | ||
import Color from './Color'; | ||
export default Color; | ||
export * as colorTypes from './Colors'; | ||
import * as Colors from './Colors'; | ||
declare namespace Color { | ||
const from: <T extends import("./ColorType").colorType>(type: string, value: string | number | number[], args?: import("./From").newColorArgs | undefined) => T; | ||
namespace colorTypes { | ||
type hex = Colors.hex; | ||
type rgb = Colors.rgb; | ||
type rec709rgb = Colors.rec709rgb; | ||
type rec2020rgb = Colors.rec2020rgb; | ||
type hsv = Colors.hsv; | ||
type hsl = Colors.hsl; | ||
type hsi = Colors.hsi; | ||
type hsp = Colors.hsp; | ||
type cmyk = Colors.cmyk; | ||
type yiq = Colors.yiq; | ||
type xyz = Colors.xyz; | ||
type xyy = Colors.xyy; | ||
type lab = Colors.lab; | ||
type luv = Colors.luv; | ||
type ypbpr = Colors.ypbpr; | ||
type ycbcr = Colors.ycbcr; | ||
type nm = Colors.nm; | ||
type kelvin = Colors.kelvin; | ||
} | ||
type rgbNormalized = Colors.rgbNormalized; | ||
type hex = Colors.hex; | ||
type rgb = Colors.rgb; | ||
type rec709rgb = Colors.rec709rgb; | ||
type rec2020rgb = Colors.rec2020rgb; | ||
type hsv = Colors.hsv; | ||
type hsl = Colors.hsl; | ||
type hsi = Colors.hsi; | ||
type hsp = Colors.hsp; | ||
type cmyk = Colors.cmyk; | ||
type yiq = Colors.yiq; | ||
type xyz = Colors.xyz; | ||
type xyy = Colors.xyy; | ||
type lab = Colors.lab; | ||
type luv = Colors.luv; | ||
type ypbpr = Colors.ypbpr; | ||
type ycbcr = Colors.ycbcr; | ||
type nm = Colors.nm; | ||
type kelvin = Colors.kelvin; | ||
} | ||
export = Color; |
@@ -17,32 +17,10 @@ "use strict"; | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.colorTypes = void 0; | ||
var Color_1 = __importDefault(require("./Color")); | ||
exports.default = Color_1.default; | ||
exports.colorTypes = __importStar(require("./Colors")); | ||
var From_1 = __importDefault(require("./From")); | ||
var Color; | ||
(function (Color) { | ||
Color.from = From_1.default; | ||
})(Color || (Color = {})); | ||
module.exports = Color; |
@@ -270,2 +270,2 @@ import * as Colors from './Colors'; | ||
} | ||
export = Modify; | ||
export default Modify; |
@@ -40,2 +40,3 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Colors = __importStar(require("./Colors")); | ||
@@ -511,2 +512,2 @@ var Modify = /** @class */ (function () { | ||
}()); | ||
module.exports = Modify; | ||
exports.default = Modify; |
@@ -97,2 +97,2 @@ import { referenceWhite } from './Reference'; | ||
} | ||
export = Util; | ||
export default Util; |
@@ -17,2 +17,3 @@ "use strict"; | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Reference_1 = require("./Reference"); | ||
@@ -254,2 +255,2 @@ var Util = /** @class */ (function () { | ||
}()); | ||
module.exports = Util; | ||
exports.default = Util; |
{ | ||
"name": "chromaticity-color-utilities", | ||
"version": "0.13.2-alpha", | ||
"version": "0.14.0-alpha", | ||
"description": "Color utilities for Node.js", | ||
@@ -8,5 +8,5 @@ "main": "dist/main.js", | ||
"test": "mocha", | ||
"test-types": "tsc test-types/types.ts --esModuleInterop && tsc test-types/types-new.ts --esModuleInterop", | ||
"servetest": "nodemon serverTest/app.js" | ||
}, | ||
"dependencies": {}, | ||
"engines": { | ||
@@ -13,0 +13,0 @@ "node": ">= 10.0.0" |
@@ -13,14 +13,20 @@ # <img src="https://reiniiriarios.github.io/chromaticity-color-utilities/img/chromaticity-icon-01.png" width="26" height="26"> chromaticity-color-utilities | ||
[**📖 Read Full Documentation**](https://reiniiriarios.github.io/chromaticity-color-utilities) | ||
## Install | ||
`npm i chromaticity-color-utilities` | ||
## Documentation | ||
📖 Please [**read the full Documentation**](https://reiniiriarios.github.io/chromaticity-color-utilities) for details on each method as well as numerous usage examples. | ||
## Example Usage | ||
### JavaScript | ||
### TypeScript | ||
```js | ||
const Color = require('chromaticity-color-utilities') | ||
```ts | ||
import Color from 'chromaticity-color-utilities' | ||
const color1 = Color.from('rgb', [255, 128, 0]).to('hsv') | ||
const color1: Color.hsv = Color.from('rgb', [255, 128, 0]).to('hsv') | ||
const scheme1 = Color.from('hex', 0x9a237f) | ||
const scheme1: Color.lab[] = Color.from('hex', 0x9a237f) | ||
.modify('desaturate', { amount: 0.2 }) | ||
@@ -35,12 +41,19 @@ .to('lab', { | ||
}) | ||
const yourMethod = (rgb: Color.rgb): Color.hsv => { | ||
// do things | ||
let hsv: Color.hsv = rgb.to('hsv') | ||
// do things | ||
return hsv | ||
} | ||
``` | ||
### TypeScript | ||
### JavaScript | ||
```ts | ||
import Color, { colorTypes } from 'chromaticity-color-utilities' | ||
```js | ||
const Color = require('chromaticity-color-utilities') | ||
const color1: colorTypes.hsv = Color.from('rgb', [255, 128, 0]).to('hsv') | ||
const color1 = Color.from('rgb', [255, 128, 0]).to('hsv') | ||
const scheme1: colorTypes.lab[] = Color.from('hex', 0x9a237f) | ||
const scheme1 = Color.from('hex', 0x9a237f) | ||
.modify('desaturate', { amount: 0.2 }) | ||
@@ -55,18 +68,13 @@ .to('lab', { | ||
}) | ||
const yourMethod = (rgb: colorTypes.rgb): colorTypes.hsv => { | ||
// do things | ||
let hsv: colorTypes.hsv = rgb.to('hsv') | ||
// do things | ||
return hsv | ||
} | ||
``` | ||
## Install | ||
### TypeScript (deprecated type import method) | ||
`npm i chromaticity-color-utilities` | ||
`colorTypes` is still supported, but deprecated and will be removed in a future release. | ||
## Documentation | ||
```ts | ||
import Color, { colorTypes } from 'chromaticity-color-utilities' | ||
Please [read the full documentation](https://reiniiriarios.github.io/chromaticity-color-utilities) for details on each method as well as numerous usage examples. | ||
const color1: colorTypes.hsv = Color.from('rgb', [255, 128, 0]).to('hsv') | ||
``` | ||
@@ -73,0 +81,0 @@ ## Known Issues |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
362508
28
8815
109