color-bits 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-bits",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"./*": "./build/*",
|
|
9
9
|
"./string": "./build/string.js"
|
|
10
10
|
},
|
|
11
|
+
"types": "./build/index.d.ts",
|
|
11
12
|
"keywords": [
|
|
12
13
|
"color",
|
|
13
14
|
"colors"
|
package/build/transform.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Color } from './core';
|
|
2
|
-
/**
|
|
3
|
-
* Modifies color alpha channel.
|
|
4
|
-
* @param color - Color
|
|
5
|
-
* @param value - Value in the range [0, 1]
|
|
6
|
-
*/
|
|
7
|
-
export declare function alpha(color: Color, value: number): Color;
|
|
8
|
-
/**
|
|
9
|
-
* Darkens a color.
|
|
10
|
-
* @param color - Color
|
|
11
|
-
* @param coefficient - Multiplier in the range [0, 1]
|
|
12
|
-
*/
|
|
13
|
-
export declare function darken(color: Color, coefficient: number): Color;
|
|
14
|
-
/**
|
|
15
|
-
* Lighten a color.
|
|
16
|
-
* @param color - Color
|
|
17
|
-
* @param coefficient - Multiplier in the range [0, 1]
|
|
18
|
-
*/
|
|
19
|
-
export declare function lighten(color: Color, coefficient: number): Color;
|
package/build/transform.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alpha = alpha;
|
|
4
|
-
exports.darken = darken;
|
|
5
|
-
exports.lighten = lighten;
|
|
6
|
-
const core_1 = require("./core");
|
|
7
|
-
/**
|
|
8
|
-
* Modifies color alpha channel.
|
|
9
|
-
* @param color - Color
|
|
10
|
-
* @param value - Value in the range [0, 1]
|
|
11
|
-
*/
|
|
12
|
-
function alpha(color, value) {
|
|
13
|
-
return (0, core_1.setAlpha)(color, Math.round(value * 255));
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Darkens a color.
|
|
17
|
-
* @param color - Color
|
|
18
|
-
* @param coefficient - Multiplier in the range [0, 1]
|
|
19
|
-
*/
|
|
20
|
-
function darken(color, coefficient) {
|
|
21
|
-
const r = (0, core_1.getRed)(color);
|
|
22
|
-
const g = (0, core_1.getGreen)(color);
|
|
23
|
-
const b = (0, core_1.getBlue)(color);
|
|
24
|
-
const a = (0, core_1.getAlpha)(color);
|
|
25
|
-
const factor = 1 - coefficient;
|
|
26
|
-
return (0, core_1.newColor)(r * factor, g * factor, b * factor, a);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Lighten a color.
|
|
30
|
-
* @param color - Color
|
|
31
|
-
* @param coefficient - Multiplier in the range [0, 1]
|
|
32
|
-
*/
|
|
33
|
-
function lighten(color, coefficient) {
|
|
34
|
-
const r = (0, core_1.getRed)(color);
|
|
35
|
-
const g = (0, core_1.getGreen)(color);
|
|
36
|
-
const b = (0, core_1.getBlue)(color);
|
|
37
|
-
const a = (0, core_1.getAlpha)(color);
|
|
38
|
-
return (0, core_1.newColor)(r + (255 - r) * coefficient, g + (255 - g) * coefficient, b + (255 - b) * coefficient, a);
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=transform.js.map
|
package/build/transform.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;AAeA,sBAEC;AAOD,wBAcC;AAOD,0BAYC;AAzDD,iCAQgB;AAEhB;;;;GAIG;AACH,SAAgB,KAAK,CAAC,KAAY,EAAE,KAAa;IAC/C,OAAO,IAAA,eAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAA;AACjD,CAAC;AAED;;;;GAIG;AACH,SAAgB,MAAM,CAAC,KAAY,EAAE,WAAmB;IACtD,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,cAAO,EAAC,KAAK,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAE1B,MAAM,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC;IAE/B,OAAO,IAAA,eAAQ,EACb,CAAC,GAAG,MAAM,EACV,CAAC,GAAG,MAAM,EACV,CAAC,GAAG,MAAM,EACV,CAAC,CACF,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,KAAY,EAAE,WAAmB;IACvD,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,cAAO,EAAC,KAAK,CAAC,CAAC;IACzB,MAAM,CAAC,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,CAAC;IAE1B,OAAO,IAAA,eAAQ,EACb,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,EAC3B,CAAC,CACF,CAAA;AACH,CAAC"}
|
package/build/transformString.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.alpha = alpha;
|
|
27
|
-
exports.darken = darken;
|
|
28
|
-
exports.lighten = lighten;
|
|
29
|
-
const core_1 = require("./core");
|
|
30
|
-
const parse_1 = require("./parse");
|
|
31
|
-
const Transform = __importStar(require("./transform"));
|
|
32
|
-
function alpha(color, value) { return (0, core_1.from)(Transform.alpha((0, parse_1.parse)(color), value)); }
|
|
33
|
-
function darken(color, value) { return (0, core_1.from)(Transform.darken((0, parse_1.parse)(color), value)); }
|
|
34
|
-
function lighten(color, value) { return (0, core_1.from)(Transform.lighten((0, parse_1.parse)(color), value)); }
|
|
35
|
-
//# sourceMappingURL=transformString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformString.js","sourceRoot":"","sources":["../src/transformString.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,sBAAyG;AACzG,wBAA2G;AAC3G,0BAA6G;AAN7G,iCAA6B;AAC7B,mCAA+B;AAC/B,uDAAwC;AAExC,SAAgB,KAAK,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,KAAK,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AACzG,SAAgB,MAAM,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,MAAM,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC;AAC3G,SAAgB,OAAO,CAAC,KAAa,EAAE,KAAa,IAAI,OAAO,IAAA,WAAI,EAAC,SAAS,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC,CAAC"}
|