From c64c79ecb9bb0e2323289dc3bdd95d598b79153d Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sun, 10 Jul 2022 17:27:04 +0800 Subject: [PATCH] init project. --- .gitattributes | 1 + .github/workflows/ci.yml | 39 +++++++++ .gitignore | 22 +++++ .husky/pre-commit | 4 + .prettierignore | 9 +++ .prettierrc | 11 +++ LICENSE | 21 +++++ README.md | 61 ++++++++++++++ package.json | 47 +++++++++++ renovate.json | 10 +++ src/__tests__/index.test.ts | 152 +++++++++++++++++++++++++++++++++++ src/index.ts | 155 ++++++++++++++++++++++++++++++++++++ tsconfig.json | 19 +++++ 13 files changed, 551 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100755 .husky/pre-commit create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 package.json create mode 100644 renovate.json create mode 100644 src/__tests__/index.test.ts create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..afb6cf8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.husky/* linguist-detectable=false \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..499ebe3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI +on: + push: + branches: + - main + +jobs: + build-deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - run: npm install + - run: npm run build + - run: npm run type-check + - run: npm run coverage + + - name: Converts Markdown to HTML + uses: jaywcjlove/markdown-to-html-cli@main + with: + output: coverage/index.html + github-corners: https://github.com/jaywcjlove/colors-named + favicon: data:image/svg+xml,🎨 + + - name: Create Coverage Badges + uses: jaywcjlove/coverage-badges-cli@main + with: + source: coverage/coverage-summary.json + output: coverage/badges.svg + + - name: Generate Contributors Images + uses: jaywcjlove/github-action-contributors@main + with: + filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) + output: coverage/CONTRIBUTORS.svg + avatarSize: 42 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..65e8231 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +build +dist +lib +cjs +esm +node_modules +coverage +npm-debug.log* +package-lock.json + +.eslintcache +.DS_Store +.cache +.rdoc-dist + +*.log +*.bak +*.tem +*.temp +#.swp +*.*~ +~*.* diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..ca7c756 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no-install lint-staged \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..899b305 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +**/*.md +package.json +package-lock.json +node_modules +dist +build +coverage +lib +test \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..2936709 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 120, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7f80c92 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Kenny Wang + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bccad46 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +colors-named +=== + +[![Build & Deploy](https://github.com/jaywcjlove/colors-named/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/colors-named/actions/workflows/ci.yml) +[![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/colors-named/file/README.md) +[![npm version](https://img.shields.io/npm/v/colors-named.svg)](https://www.npmjs.com/package/colors-named) +[![Coverage Status](https://jaywcjlove.github.io/colors-named/badges.svg)](https://jaywcjlove.github.io/colors-named/lcov-report/) + +A array with color names. Based on https://www.w3.org/TR/css-color-4/#named-colors + +## Installation + +This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be import instead of require. + +```bash +npm install colors-named +``` + +If you still want to use in CommonJS, you can use dynamic `import()` to load. + +```js +const named = await import('colors-named'); + +// Fix compiling in typescript. +// https://github.com/microsoft/TypeScript/issues/43329#issuecomment-922544562 +const named = await (Function('return import("colors-named")')()) as Promise; +``` + +## Usage + +```js +import named from "colors-named"; + +console.log(named) // => ['aliceblue', 'antiquewhite', 'aqua', ... ] +console.log(named.includes('red')) // => true +console.log(named.length) // => 148 +``` + +## API + +```ts +/** + * A array with color names. Based on https://www.w3.org/TR/css-color-4/#named-colors + */ +declare const names: readonly ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]; +export default names; +``` + +## Contributors + +As always, thanks to our amazing contributors! + + + + + +Made with [action-contributors](https://github.com/jaywcjlove/github-action-contributors). + +## License + +Licensed under the MIT License. diff --git a/package.json b/package.json new file mode 100644 index 0000000..b165999 --- /dev/null +++ b/package.json @@ -0,0 +1,47 @@ +{ + "name": "colors-named", + "version": "0.0.1", + "description": "A array with color names.", + "type": "module", + "types": "./lib/index.d.ts", + "exports": "./lib/index.js", + "homepage": "https://jaywcjlove.github.io/colors-named/", + "repository": { + "type": "git", + "url": "https://github.com/jaywcjlove/colors-named" + }, + "scripts": { + "prepack": "husky install && npm run build", + "start": "tsbb watch --disable-babel", + "build": "tsbb build --disable-babel", + "type-check": "tsc --noEmit", + "test": "tsbb test", + "coverage": "tsbb test --coverage", + "prettier": "prettier --write \"**/*.{js,ts,json}\"" + }, + "keywords": [ + "color", + "colors", + "colors-named", + "named-colors", + "named" + ], + "author": "Kenny Wang", + "license": "MIT", + "files": [ + "src/index.ts", + "lib" + ], + "engines": { + "node": ">=14.16" + }, + "lint-staged": { + "*.{js,ts,json}": "prettier --write" + }, + "devDependencies": { + "husky": "^8.0.1", + "lint-staged": "^13.0.3", + "prettier": "^2.7.1", + "tsbb": "~3.7.6" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..ad0a2a8 --- /dev/null +++ b/renovate.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:base"], + "packageRules": [ + { + "matchPackagePatterns": ["*"], + "rangeStrategy": "replace" + } + ] +} diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts new file mode 100644 index 0000000..58998ca --- /dev/null +++ b/src/__tests__/index.test.ts @@ -0,0 +1,152 @@ +import names from '../'; + +it('=> names.length', () => expect(names.length).toBe(148)); +it('=> includes rebeccapurple', () => expect(names.includes('rebeccapurple')).toBeTruthy()); +it('=> includes aliceblue', () => expect(names.includes('aliceblue')).toBeTruthy()); +it('=> includes antiquewhite', () => expect(names.includes('antiquewhite')).toBeTruthy()); +it('=> includes aqua', () => expect(names.includes('aqua')).toBeTruthy()); +it('=> includes aquamarine', () => expect(names.includes('aquamarine')).toBeTruthy()); +it('=> includes azure', () => expect(names.includes('azure')).toBeTruthy()); +it('=> includes beige', () => expect(names.includes('beige')).toBeTruthy()); +it('=> includes bisque', () => expect(names.includes('bisque')).toBeTruthy()); +it('=> includes black', () => expect(names.includes('black')).toBeTruthy()); +it('=> includes blanchedalmond', () => expect(names.includes('blanchedalmond')).toBeTruthy()); +it('=> includes blue', () => expect(names.includes('blue')).toBeTruthy()); +it('=> includes blueviolet', () => expect(names.includes('blueviolet')).toBeTruthy()); +it('=> includes brown', () => expect(names.includes('brown')).toBeTruthy()); +it('=> includes burlywood', () => expect(names.includes('burlywood')).toBeTruthy()); +it('=> includes cadetblue', () => expect(names.includes('cadetblue')).toBeTruthy()); +it('=> includes chartreuse', () => expect(names.includes('chartreuse')).toBeTruthy()); +it('=> includes chocolate', () => expect(names.includes('chocolate')).toBeTruthy()); +it('=> includes coral', () => expect(names.includes('coral')).toBeTruthy()); +it('=> includes cornflowerblue', () => expect(names.includes('cornflowerblue')).toBeTruthy()); +it('=> includes cornsilk', () => expect(names.includes('cornsilk')).toBeTruthy()); +it('=> includes crimson', () => expect(names.includes('crimson')).toBeTruthy()); +it('=> includes cyan', () => expect(names.includes('cyan')).toBeTruthy()); +it('=> includes darkblue', () => expect(names.includes('darkblue')).toBeTruthy()); +it('=> includes darkcyan', () => expect(names.includes('darkcyan')).toBeTruthy()); +it('=> includes darkgoldenrod', () => expect(names.includes('darkgoldenrod')).toBeTruthy()); +it('=> includes darkgray', () => expect(names.includes('darkgray')).toBeTruthy()); +it('=> includes darkgreen', () => expect(names.includes('darkgreen')).toBeTruthy()); +it('=> includes darkgrey', () => expect(names.includes('darkgrey')).toBeTruthy()); +it('=> includes darkkhaki', () => expect(names.includes('darkkhaki')).toBeTruthy()); +it('=> includes darkmagenta', () => expect(names.includes('darkmagenta')).toBeTruthy()); +it('=> includes darkolivegreen', () => expect(names.includes('darkolivegreen')).toBeTruthy()); +it('=> includes darkorange', () => expect(names.includes('darkorange')).toBeTruthy()); +it('=> includes darkorchid', () => expect(names.includes('darkorchid')).toBeTruthy()); +it('=> includes darkred', () => expect(names.includes('darkred')).toBeTruthy()); +it('=> includes darksalmon', () => expect(names.includes('darksalmon')).toBeTruthy()); +it('=> includes darkseagreen', () => expect(names.includes('darkseagreen')).toBeTruthy()); +it('=> includes darkslateblue', () => expect(names.includes('darkslateblue')).toBeTruthy()); +it('=> includes darkslategray', () => expect(names.includes('darkslategray')).toBeTruthy()); +it('=> includes darkslategrey', () => expect(names.includes('darkslategrey')).toBeTruthy()); +it('=> includes darkturquoise', () => expect(names.includes('darkturquoise')).toBeTruthy()); +it('=> includes darkviolet', () => expect(names.includes('darkviolet')).toBeTruthy()); +it('=> includes deeppink', () => expect(names.includes('deeppink')).toBeTruthy()); +it('=> includes deepskyblue', () => expect(names.includes('deepskyblue')).toBeTruthy()); +it('=> includes dimgray', () => expect(names.includes('dimgray')).toBeTruthy()); +it('=> includes dimgrey', () => expect(names.includes('dimgrey')).toBeTruthy()); +it('=> includes dodgerblue', () => expect(names.includes('dodgerblue')).toBeTruthy()); +it('=> includes firebrick', () => expect(names.includes('firebrick')).toBeTruthy()); +it('=> includes floralwhite', () => expect(names.includes('floralwhite')).toBeTruthy()); +it('=> includes forestgreen', () => expect(names.includes('forestgreen')).toBeTruthy()); +it('=> includes fuchsia', () => expect(names.includes('fuchsia')).toBeTruthy()); +it('=> includes gainsboro', () => expect(names.includes('gainsboro')).toBeTruthy()); +it('=> includes ghostwhite', () => expect(names.includes('ghostwhite')).toBeTruthy()); +it('=> includes gold', () => expect(names.includes('gold')).toBeTruthy()); +it('=> includes goldenrod', () => expect(names.includes('goldenrod')).toBeTruthy()); +it('=> includes gray', () => expect(names.includes('gray')).toBeTruthy()); +it('=> includes green', () => expect(names.includes('green')).toBeTruthy()); +it('=> includes greenyellow', () => expect(names.includes('greenyellow')).toBeTruthy()); +it('=> includes grey', () => expect(names.includes('grey')).toBeTruthy()); +it('=> includes honeydew', () => expect(names.includes('honeydew')).toBeTruthy()); +it('=> includes hotpink', () => expect(names.includes('hotpink')).toBeTruthy()); +it('=> includes indianred', () => expect(names.includes('indianred')).toBeTruthy()); +it('=> includes indigo', () => expect(names.includes('indigo')).toBeTruthy()); +it('=> includes ivory', () => expect(names.includes('ivory')).toBeTruthy()); +it('=> includes khaki', () => expect(names.includes('khaki')).toBeTruthy()); +it('=> includes lavender', () => expect(names.includes('lavender')).toBeTruthy()); +it('=> includes lavenderblush', () => expect(names.includes('lavenderblush')).toBeTruthy()); +it('=> includes lawngreen', () => expect(names.includes('lawngreen')).toBeTruthy()); +it('=> includes lemonchiffon', () => expect(names.includes('lemonchiffon')).toBeTruthy()); +it('=> includes lightblue', () => expect(names.includes('lightblue')).toBeTruthy()); +it('=> includes lightcoral', () => expect(names.includes('lightcoral')).toBeTruthy()); +it('=> includes lightcyan', () => expect(names.includes('lightcyan')).toBeTruthy()); +it('=> includes lightgoldenrodyellow', () => expect(names.includes('lightgoldenrodyellow')).toBeTruthy()); +it('=> includes lightgray', () => expect(names.includes('lightgray')).toBeTruthy()); +it('=> includes lightgreen', () => expect(names.includes('lightgreen')).toBeTruthy()); +it('=> includes lightgrey', () => expect(names.includes('lightgrey')).toBeTruthy()); +it('=> includes lightpink', () => expect(names.includes('lightpink')).toBeTruthy()); +it('=> includes lightsalmon', () => expect(names.includes('lightsalmon')).toBeTruthy()); +it('=> includes lightseagreen', () => expect(names.includes('lightseagreen')).toBeTruthy()); +it('=> includes lightskyblue', () => expect(names.includes('lightskyblue')).toBeTruthy()); +it('=> includes lightslategray', () => expect(names.includes('lightslategray')).toBeTruthy()); +it('=> includes lightslategrey', () => expect(names.includes('lightslategrey')).toBeTruthy()); +it('=> includes lightsteelblue', () => expect(names.includes('lightsteelblue')).toBeTruthy()); +it('=> includes lightyellow', () => expect(names.includes('lightyellow')).toBeTruthy()); +it('=> includes lime', () => expect(names.includes('lime')).toBeTruthy()); +it('=> includes limegreen', () => expect(names.includes('limegreen')).toBeTruthy()); +it('=> includes linen', () => expect(names.includes('linen')).toBeTruthy()); +it('=> includes magenta', () => expect(names.includes('magenta')).toBeTruthy()); +it('=> includes maroon', () => expect(names.includes('maroon')).toBeTruthy()); +it('=> includes mediumaquamarine', () => expect(names.includes('mediumaquamarine')).toBeTruthy()); +it('=> includes mediumblue', () => expect(names.includes('mediumblue')).toBeTruthy()); +it('=> includes mediumorchid', () => expect(names.includes('mediumorchid')).toBeTruthy()); +it('=> includes mediumpurple', () => expect(names.includes('mediumpurple')).toBeTruthy()); +it('=> includes mediumseagreen', () => expect(names.includes('mediumseagreen')).toBeTruthy()); +it('=> includes mediumslateblue', () => expect(names.includes('mediumslateblue')).toBeTruthy()); +it('=> includes mediumspringgreen', () => expect(names.includes('mediumspringgreen')).toBeTruthy()); +it('=> includes mediumturquoise', () => expect(names.includes('mediumturquoise')).toBeTruthy()); +it('=> includes mediumvioletred', () => expect(names.includes('mediumvioletred')).toBeTruthy()); +it('=> includes midnightblue', () => expect(names.includes('midnightblue')).toBeTruthy()); +it('=> includes mintcream', () => expect(names.includes('mintcream')).toBeTruthy()); +it('=> includes mistyrose', () => expect(names.includes('mistyrose')).toBeTruthy()); +it('=> includes moccasin', () => expect(names.includes('moccasin')).toBeTruthy()); +it('=> includes navajowhite', () => expect(names.includes('navajowhite')).toBeTruthy()); +it('=> includes navy', () => expect(names.includes('navy')).toBeTruthy()); +it('=> includes oldlace', () => expect(names.includes('oldlace')).toBeTruthy()); +it('=> includes olive', () => expect(names.includes('olive')).toBeTruthy()); +it('=> includes olivedrab', () => expect(names.includes('olivedrab')).toBeTruthy()); +it('=> includes orange', () => expect(names.includes('orange')).toBeTruthy()); +it('=> includes orangered', () => expect(names.includes('orangered')).toBeTruthy()); +it('=> includes orchid', () => expect(names.includes('orchid')).toBeTruthy()); +it('=> includes palegoldenrod', () => expect(names.includes('palegoldenrod')).toBeTruthy()); +it('=> includes palegreen', () => expect(names.includes('palegreen')).toBeTruthy()); +it('=> includes paleturquoise', () => expect(names.includes('paleturquoise')).toBeTruthy()); +it('=> includes palevioletred', () => expect(names.includes('palevioletred')).toBeTruthy()); +it('=> includes papayawhip', () => expect(names.includes('papayawhip')).toBeTruthy()); +it('=> includes peachpuff', () => expect(names.includes('peachpuff')).toBeTruthy()); +it('=> includes peru', () => expect(names.includes('peru')).toBeTruthy()); +it('=> includes pink', () => expect(names.includes('pink')).toBeTruthy()); +it('=> includes plum', () => expect(names.includes('plum')).toBeTruthy()); +it('=> includes powderblue', () => expect(names.includes('powderblue')).toBeTruthy()); +it('=> includes purple', () => expect(names.includes('purple')).toBeTruthy()); +it('=> includes rebeccapurple', () => expect(names.includes('rebeccapurple')).toBeTruthy()); +it('=> includes red', () => expect(names.includes('red')).toBeTruthy()); +it('=> includes rosybrown', () => expect(names.includes('rosybrown')).toBeTruthy()); +it('=> includes royalblue', () => expect(names.includes('royalblue')).toBeTruthy()); +it('=> includes saddlebrown', () => expect(names.includes('saddlebrown')).toBeTruthy()); +it('=> includes salmon', () => expect(names.includes('salmon')).toBeTruthy()); +it('=> includes sandybrown', () => expect(names.includes('sandybrown')).toBeTruthy()); +it('=> includes seagreen', () => expect(names.includes('seagreen')).toBeTruthy()); +it('=> includes seashell', () => expect(names.includes('seashell')).toBeTruthy()); +it('=> includes sienna', () => expect(names.includes('sienna')).toBeTruthy()); +it('=> includes silver', () => expect(names.includes('silver')).toBeTruthy()); +it('=> includes skyblue', () => expect(names.includes('skyblue')).toBeTruthy()); +it('=> includes slateblue', () => expect(names.includes('slateblue')).toBeTruthy()); +it('=> includes slategray', () => expect(names.includes('slategray')).toBeTruthy()); +it('=> includes slategrey', () => expect(names.includes('slategrey')).toBeTruthy()); +it('=> includes snow', () => expect(names.includes('snow')).toBeTruthy()); +it('=> includes springgreen', () => expect(names.includes('springgreen')).toBeTruthy()); +it('=> includes steelblue', () => expect(names.includes('steelblue')).toBeTruthy()); +it('=> includes tan', () => expect(names.includes('tan')).toBeTruthy()); +it('=> includes teal', () => expect(names.includes('teal')).toBeTruthy()); +it('=> includes thistle', () => expect(names.includes('thistle')).toBeTruthy()); +it('=> includes tomato', () => expect(names.includes('tomato')).toBeTruthy()); +it('=> includes turquoise', () => expect(names.includes('turquoise')).toBeTruthy()); +it('=> includes violet', () => expect(names.includes('violet')).toBeTruthy()); +it('=> includes wheat', () => expect(names.includes('wheat')).toBeTruthy()); +it('=> includes white', () => expect(names.includes('white')).toBeTruthy()); +it('=> includes whitesmoke', () => expect(names.includes('whitesmoke')).toBeTruthy()); +it('=> includes yellow', () => expect(names.includes('yellow')).toBeTruthy()); +it('=> includes yellowgreen', () => expect(names.includes('yellowgreen')).toBeTruthy()); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..73f5d8a --- /dev/null +++ b/src/index.ts @@ -0,0 +1,155 @@ +/** + * A array with color names. Based on https://www.w3.org/TR/css-color-4/#named-colors + */ +const names = [ + 'aliceblue', + 'antiquewhite', + 'aqua', + 'aquamarine', + 'azure', + 'beige', + 'bisque', + 'black', + 'blanchedalmond', + 'blue', + 'blueviolet', + 'brown', + 'burlywood', + 'cadetblue', + 'chartreuse', + 'chocolate', + 'coral', + 'cornflowerblue', + 'cornsilk', + 'crimson', + 'cyan', + 'darkblue', + 'darkcyan', + 'darkgoldenrod', + 'darkgray', + 'darkgreen', + 'darkgrey', + 'darkkhaki', + 'darkmagenta', + 'darkolivegreen', + 'darkorange', + 'darkorchid', + 'darkred', + 'darksalmon', + 'darkseagreen', + 'darkslateblue', + 'darkslategray', + 'darkslategrey', + 'darkturquoise', + 'darkviolet', + 'deeppink', + 'deepskyblue', + 'dimgray', + 'dimgrey', + 'dodgerblue', + 'firebrick', + 'floralwhite', + 'forestgreen', + 'fuchsia', + 'gainsboro', + 'ghostwhite', + 'gold', + 'goldenrod', + 'gray', + 'green', + 'greenyellow', + 'grey', + 'honeydew', + 'hotpink', + 'indianred', + 'indigo', + 'ivory', + 'khaki', + 'lavender', + 'lavenderblush', + 'lawngreen', + 'lemonchiffon', + 'lightblue', + 'lightcoral', + 'lightcyan', + 'lightgoldenrodyellow', + 'lightgray', + 'lightgreen', + 'lightgrey', + 'lightpink', + 'lightsalmon', + 'lightseagreen', + 'lightskyblue', + 'lightslategray', + 'lightslategrey', + 'lightsteelblue', + 'lightyellow', + 'lime', + 'limegreen', + 'linen', + 'magenta', + 'maroon', + 'mediumaquamarine', + 'mediumblue', + 'mediumorchid', + 'mediumpurple', + 'mediumseagreen', + 'mediumslateblue', + 'mediumspringgreen', + 'mediumturquoise', + 'mediumvioletred', + 'midnightblue', + 'mintcream', + 'mistyrose', + 'moccasin', + 'navajowhite', + 'navy', + 'oldlace', + 'olive', + 'olivedrab', + 'orange', + 'orangered', + 'orchid', + 'palegoldenrod', + 'palegreen', + 'paleturquoise', + 'palevioletred', + 'papayawhip', + 'peachpuff', + 'peru', + 'pink', + 'plum', + 'powderblue', + 'purple', + 'rebeccapurple', + 'red', + 'rosybrown', + 'royalblue', + 'saddlebrown', + 'salmon', + 'sandybrown', + 'seagreen', + 'seashell', + 'sienna', + 'silver', + 'skyblue', + 'slateblue', + 'slategray', + 'slategrey', + 'snow', + 'springgreen', + 'steelblue', + 'tan', + 'teal', + 'thistle', + 'tomato', + 'turquoise', + 'violet', + 'wheat', + 'white', + 'whitesmoke', + 'yellow', + 'yellowgreen', +] as const; + +export default names; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a6265bb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "sourceMap": true, + "declaration": true, + "noFallthroughCasesInSwitch": true, + "noImplicitThis": true, + "strictBindCallApply": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "esModuleInterop": false, + "noImplicitAny": true, + "outDir": "lib", + "baseUrl": "." + } +}