Comparing version 0.1.17 to 0.1.18
@@ -14,1 +14,4 @@ export declare type RGBA = [number, number, number, number]; | ||
export declare function scaleColor(base: string | RGB | RGBA, options: ScaleColorOptions): string; | ||
export declare function getAlpha(base: string | RGB | RGBA): number; | ||
export declare function getAlphaString(base: string | RGB | RGBA): string; | ||
export declare function toRgbString(base: string | RGB | RGBA): string; |
@@ -84,2 +84,5 @@ const prefix = '^\\s*'; | ||
} | ||
function stringifyRgb(r, g, b) { | ||
return `rgb(${normalizeChannel(r)}, ${normalizeChannel(g)}, ${normalizeChannel(b)})`; | ||
} | ||
function stringifyRgba(r, g, b, a) { | ||
@@ -113,1 +116,13 @@ return `rgba(${normalizeChannel(r)}, ${normalizeChannel(g)}, ${normalizeChannel(b)}, ${normalizeAlpha(a)})`; | ||
} | ||
export function getAlpha(base) { | ||
var _a; | ||
const alpha = (_a = (Array.isArray(base) ? base : rgba(base))[3]) !== null && _a !== void 0 ? _a : 1; | ||
return alpha; | ||
} | ||
export function getAlphaString(base) { | ||
return `${getAlpha(base)}`; | ||
} | ||
export function toRgbString(base) { | ||
const [r, g, b] = Array.isArray(base) ? base : rgba(base); | ||
return stringifyRgb(r, g, b); | ||
} |
@@ -7,3 +7,3 @@ export { beforeNextFrameOnce } from './animation/next-frame-once'; | ||
export { depx, pxfy, getPadding, getMargin, parseResponsiveProp, parseResponsivePropValue, Position, Margin } from './css'; | ||
export { changeColor, rgba, composite, scaleColor, ChangeColorOptions, ScaleColorOptions, RGB, RGBA } from './color'; | ||
export { changeColor, rgba, composite, scaleColor, getAlphaString, toRgbString, getAlpha, ChangeColorOptions, ScaleColorOptions, RGB, RGBA } from './color'; | ||
export { createId } from './misc/index'; |
@@ -7,3 +7,3 @@ export { beforeNextFrameOnce } from './animation/next-frame-once'; | ||
export { depx, pxfy, getPadding, getMargin, parseResponsiveProp, parseResponsivePropValue } from './css'; | ||
export { changeColor, rgba, composite, scaleColor } from './color'; | ||
export { changeColor, rgba, composite, scaleColor, getAlphaString, toRgbString, getAlpha } from './color'; | ||
export { createId } from './misc/index'; |
@@ -14,1 +14,4 @@ export declare type RGBA = [number, number, number, number]; | ||
export declare function scaleColor(base: string | RGB | RGBA, options: ScaleColorOptions): string; | ||
export declare function getAlpha(base: string | RGB | RGBA): number; | ||
export declare function getAlphaString(base: string | RGB | RGBA): string; | ||
export declare function toRgbString(base: string | RGB | RGBA): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.scaleColor = exports.changeColor = exports.composite = exports.rgba = void 0; | ||
exports.toRgbString = exports.getAlphaString = exports.getAlpha = exports.scaleColor = exports.changeColor = exports.composite = exports.rgba = void 0; | ||
const prefix = '^\\s*'; | ||
@@ -88,2 +88,5 @@ const suffix = '\\s*$'; | ||
} | ||
function stringifyRgb(r, g, b) { | ||
return `rgb(${normalizeChannel(r)}, ${normalizeChannel(g)}, ${normalizeChannel(b)})`; | ||
} | ||
function stringifyRgba(r, g, b, a) { | ||
@@ -120,1 +123,16 @@ return `rgba(${normalizeChannel(r)}, ${normalizeChannel(g)}, ${normalizeChannel(b)}, ${normalizeAlpha(a)})`; | ||
exports.scaleColor = scaleColor; | ||
function getAlpha(base) { | ||
var _a; | ||
const alpha = (_a = (Array.isArray(base) ? base : rgba(base))[3]) !== null && _a !== void 0 ? _a : 1; | ||
return alpha; | ||
} | ||
exports.getAlpha = getAlpha; | ||
function getAlphaString(base) { | ||
return `${getAlpha(base)}`; | ||
} | ||
exports.getAlphaString = getAlphaString; | ||
function toRgbString(base) { | ||
const [r, g, b] = Array.isArray(base) ? base : rgba(base); | ||
return stringifyRgb(r, g, b); | ||
} | ||
exports.toRgbString = toRgbString; |
@@ -7,3 +7,3 @@ export { beforeNextFrameOnce } from './animation/next-frame-once'; | ||
export { depx, pxfy, getPadding, getMargin, parseResponsiveProp, parseResponsivePropValue, Position, Margin } from './css'; | ||
export { changeColor, rgba, composite, scaleColor, ChangeColorOptions, ScaleColorOptions, RGB, RGBA } from './color'; | ||
export { changeColor, rgba, composite, scaleColor, getAlphaString, toRgbString, getAlpha, ChangeColorOptions, ScaleColorOptions, RGB, RGBA } from './color'; | ||
export { createId } from './misc/index'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createId = exports.scaleColor = exports.composite = exports.rgba = exports.changeColor = exports.parseResponsivePropValue = exports.parseResponsiveProp = exports.getMargin = exports.getPadding = exports.pxfy = exports.depx = exports.happensIn = exports.unwrapElement = exports.getScrollParent = exports.beforeNextFrame = exports.beforeNextFrameOnce = void 0; | ||
exports.createId = exports.getAlpha = exports.toRgbString = exports.getAlphaString = exports.scaleColor = exports.composite = exports.rgba = exports.changeColor = exports.parseResponsivePropValue = exports.parseResponsiveProp = exports.getMargin = exports.getPadding = exports.pxfy = exports.depx = exports.happensIn = exports.unwrapElement = exports.getScrollParent = exports.beforeNextFrame = exports.beforeNextFrameOnce = void 0; | ||
var next_frame_once_1 = require("./animation/next-frame-once"); | ||
@@ -26,3 +26,6 @@ Object.defineProperty(exports, "beforeNextFrameOnce", { enumerable: true, get: function () { return next_frame_once_1.beforeNextFrameOnce; } }); | ||
Object.defineProperty(exports, "scaleColor", { enumerable: true, get: function () { return color_1.scaleColor; } }); | ||
Object.defineProperty(exports, "getAlphaString", { enumerable: true, get: function () { return color_1.getAlphaString; } }); | ||
Object.defineProperty(exports, "toRgbString", { enumerable: true, get: function () { return color_1.toRgbString; } }); | ||
Object.defineProperty(exports, "getAlpha", { enumerable: true, get: function () { return color_1.getAlpha; } }); | ||
var index_1 = require("./misc/index"); | ||
Object.defineProperty(exports, "createId", { enumerable: true, get: function () { return index_1.createId; } }); |
{ | ||
"name": "seemly", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"description": "Utils for user interface.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
38046
848