@tamagui/normalize-css-color
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -21,3 +21,4 @@ "use strict"; | ||
__export(src_exports, { | ||
default: () => normalizeColor, | ||
default: () => src_default, | ||
normalizeCSSColor: () => normalizeCSSColor, | ||
rgba: () => rgba | ||
@@ -27,3 +28,3 @@ }); | ||
var import_names = require("./names"); | ||
function normalizeColor(color) { | ||
function normalizeCSSColor(color) { | ||
let match = null; | ||
@@ -43,10 +44,22 @@ if (typeof color === "number") { | ||
if (match = matchers.rgb.exec(color)) { | ||
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0; | ||
return (parse255(match[1]) << 24 | // r | ||
parse255(match[2]) << 16 | // g | ||
parse255(match[3]) << 8 | // b | ||
255) >>> // a | ||
0; | ||
} | ||
if (match = matchers.rgba.exec(color)) { | ||
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0; | ||
return (parse255(match[1]) << 24 | // r | ||
parse255(match[2]) << 16 | // g | ||
parse255(match[3]) << 8 | // b | ||
parse1(match[4])) >>> // a | ||
0; | ||
} | ||
if (match = matchers.hex3.exec(color)) { | ||
return parseInt( | ||
match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", | ||
match[1] + match[1] + // r | ||
match[2] + match[2] + // g | ||
match[3] + match[3] + // b | ||
"ff", | ||
// a | ||
16 | ||
@@ -60,3 +73,7 @@ ) >>> 0; | ||
return parseInt( | ||
match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], | ||
match[1] + match[1] + // r | ||
match[2] + match[2] + // g | ||
match[3] + match[3] + // b | ||
match[4] + match[4], | ||
// a | ||
16 | ||
@@ -68,5 +85,9 @@ ) >>> 0; | ||
parse360(match[1]), | ||
// h | ||
parsePercentage(match[2]), | ||
// s | ||
parsePercentage(match[3]) | ||
) | 255) >>> 0; | ||
// l | ||
) | 255) >>> // a | ||
0; | ||
} | ||
@@ -76,5 +97,9 @@ if (match = matchers.hsla.exec(color)) { | ||
parse360(match[1]), | ||
// h | ||
parsePercentage(match[2]), | ||
// s | ||
parsePercentage(match[3]) | ||
) | parse1(match[4])) >>> 0; | ||
// l | ||
) | parse1(match[4])) >>> // a | ||
0; | ||
} | ||
@@ -170,6 +195,8 @@ return null; | ||
} | ||
var src_default = normalizeCSSColor; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
normalizeCSSColor, | ||
rgba | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -26,2 +26,3 @@ "use strict"; | ||
transparent: 0, | ||
// http://www.w3.org/TR/css3-color/#svg-color | ||
aliceblue: 4042850303, | ||
@@ -28,0 +29,0 @@ antiquewhite: 4209760255, |
import { names } from "./names"; | ||
function normalizeColor(color) { | ||
function normalizeCSSColor(color) { | ||
let match = null; | ||
@@ -17,10 +17,22 @@ if (typeof color === "number") { | ||
if (match = matchers.rgb.exec(color)) { | ||
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0; | ||
return (parse255(match[1]) << 24 | // r | ||
parse255(match[2]) << 16 | // g | ||
parse255(match[3]) << 8 | // b | ||
255) >>> // a | ||
0; | ||
} | ||
if (match = matchers.rgba.exec(color)) { | ||
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0; | ||
return (parse255(match[1]) << 24 | // r | ||
parse255(match[2]) << 16 | // g | ||
parse255(match[3]) << 8 | // b | ||
parse1(match[4])) >>> // a | ||
0; | ||
} | ||
if (match = matchers.hex3.exec(color)) { | ||
return parseInt( | ||
match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", | ||
match[1] + match[1] + // r | ||
match[2] + match[2] + // g | ||
match[3] + match[3] + // b | ||
"ff", | ||
// a | ||
16 | ||
@@ -34,3 +46,7 @@ ) >>> 0; | ||
return parseInt( | ||
match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], | ||
match[1] + match[1] + // r | ||
match[2] + match[2] + // g | ||
match[3] + match[3] + // b | ||
match[4] + match[4], | ||
// a | ||
16 | ||
@@ -42,5 +58,9 @@ ) >>> 0; | ||
parse360(match[1]), | ||
// h | ||
parsePercentage(match[2]), | ||
// s | ||
parsePercentage(match[3]) | ||
) | 255) >>> 0; | ||
// l | ||
) | 255) >>> // a | ||
0; | ||
} | ||
@@ -50,5 +70,9 @@ if (match = matchers.hsla.exec(color)) { | ||
parse360(match[1]), | ||
// h | ||
parsePercentage(match[2]), | ||
// s | ||
parsePercentage(match[3]) | ||
) | parse1(match[4])) >>> 0; | ||
// l | ||
) | parse1(match[4])) >>> // a | ||
0; | ||
} | ||
@@ -144,6 +168,8 @@ return null; | ||
} | ||
var src_default = normalizeCSSColor; | ||
export { | ||
normalizeColor as default, | ||
src_default as default, | ||
normalizeCSSColor, | ||
rgba | ||
}; | ||
//# sourceMappingURL=index.js.map |
const names = { | ||
transparent: 0, | ||
// http://www.w3.org/TR/css3-color/#svg-color | ||
aliceblue: 4042850303, | ||
@@ -4,0 +5,0 @@ antiquewhite: 4209760255, |
{ | ||
"name": "@tamagui/normalize-css-color", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"sideEffects": [ | ||
@@ -25,3 +25,3 @@ "*.css" | ||
"devDependencies": { | ||
"@tamagui/build": "^1.1.8" | ||
"@tamagui/build": "^1.1.9" | ||
}, | ||
@@ -28,0 +28,0 @@ "exports": { |
@@ -13,3 +13,3 @@ /* | ||
export default function normalizeColor(color: string): number | null { | ||
export function normalizeCSSColor(color: string): number | null { | ||
let match: RegExpExecArray | null = null | ||
@@ -218,1 +218,3 @@ | ||
} | ||
export default normalizeCSSColor |
@@ -1,2 +0,2 @@ | ||
export default function normalizeColor(color: string): number | null; | ||
export declare function normalizeCSSColor(color: string): number | null; | ||
export declare function rgba(colorInt: number): { | ||
@@ -8,2 +8,3 @@ r: number; | ||
}; | ||
export default normalizeCSSColor; | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
63345
1265