UNPKG

color-2-name

Version:

Finds the closest color name to a given hex, rgb and hsl color (with and without alpha). It uses the Euclidean distance formula to calculate the distance between colors in the RGB color space

93 lines (92 loc) 2.69 kB
{ "name": "color-2-name", "version": "1.5.0", "author": "Erik <erik@codekraft.it>", "description": "Finds the closest color name to a given hex, rgb and hsl color (with and without alpha). It uses the Euclidean distance formula to calculate the distance between colors in the RGB color space", "homepage": "https://wp-blocks.github.io/color-2-name/", "license": "ISC", "sideEffects": false, "main": "./lib/index.cjs", "module": "./lib/index.js", "type": "module", "types": "lib/index.d.ts", "browser": "lib/browser/color-2-name.min.js", "unpkg": "lib/browser/color-2-name.min.js", "jsdelivr": "lib/browser/color-2-name.js", "exports": { ".": { "types": "./lib/index.d.ts", "browser": "./lib/browser/color-2-name.js", "import": { "types": "./lib/index.d.ts", "default": "./lib/index.js" }, "require": { "types": "./lib/index.d.cts", "default": "./lib/index.cjs" } } }, "scripts": { "gen-colorSet": "node ./lib/colorSetUtils.mjs colorSet", "build": "rimraf lib && npm run build-module && npm run build-browser && npm run build-browser-min", "test": "vitest", "testsss": "vitest --run --testNamePattern=^Verification Tests Critical Bugs should throw error for invalid hex$", "test:coverage": "vitest --coverage", "lint": "npx @biomejs/biome lint --apply src", "build-module": "tsup", "build-browser": "esbuild src/index.ts --outfile=lib/browser/color-2-name.js --global-name=color2name --allow-overwrite --bundle --sourcemap", "build-browser-min": "esbuild src/index.ts --outfile=lib/browser/color-2-name.min.js --global-name=color2name --allow-overwrite --bundle --minify" }, "files": ["lib/", "tests/*.ts", "*.json", "*.md", ".gitignore", "LICENSE"], "repository": { "type": "git", "url": "https://github.com/wp-blocks/color-2-name.git" }, "bugs": { "url": "https://github.com/wp-blocks/color-2-name/issues" }, "engines": { "npm": ">=6.0.0", "node": ">=14.0.0" }, "keywords": [ "color", "color names", "color-names", "css", "css colors", "accessibility", "a11y", "hex", "rgb", "hsl", "convert colors", "color picker" ], "devDependencies": { "@biomejs/biome": "2.3.8", "@types/node": "^24.10.1", "@vitest/coverage-v8": "^4.0.14", "esbuild": "^0.27.0", "rimraf": "^6.1.2", "tsup": "^8.5.1", "typescript": "^5.9.3", "vitest": "^4.0.14" }, "tsup": { "skipNodeModulesBundle": true, "dts": true, "bundle": false, "treeshake": true, "minify": true, "shims": true, "cjsInterop": true, "target": "node16", "moduleName": "color2name", "format": ["esm", "cjs"], "tsconfig": "./tsconfig.json", "entry": ["src/**/*.ts"], "outDir": "lib" } }