color-name-list 10.28.0 → 11.0.0
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/.husky/pre-commit +1 -0
- package/README.md +68 -10
- package/dist/colornames.bestof.csv +1 -0
- package/dist/colornames.bestof.esm.js +1 -1
- package/dist/colornames.bestof.esm.mjs +1 -1
- package/dist/colornames.bestof.html +1 -1
- package/dist/colornames.bestof.json +1 -1
- package/dist/colornames.bestof.min.json +1 -1
- package/dist/colornames.bestof.scss +1 -1
- package/dist/colornames.bestof.umd.js +1 -1
- package/dist/colornames.bestof.xml +4 -0
- package/dist/colornames.bestof.yaml +3 -0
- package/dist/colornames.csv +2 -1
- package/dist/colornames.esm.js +1 -1
- package/dist/colornames.esm.mjs +1 -1
- package/dist/colornames.html +1 -1
- package/dist/colornames.json +1 -1
- package/dist/colornames.min.json +1 -1
- package/dist/colornames.scss +1 -1
- package/dist/colornames.short.esm.js +1 -1
- package/dist/colornames.short.esm.mjs +1 -1
- package/dist/colornames.umd.js +1 -1
- package/dist/colornames.xml +5 -1
- package/dist/colornames.yaml +4 -1
- package/dist/history.json +1 -1
- package/package.json +21 -7
- package/scripts/build.js +6 -7
- package/scripts/esm.js.tpl +1 -1
- package/scripts/lib.js +82 -77
- package/scripts/tools/history.js +2 -3
- package/src/colornames.csv +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm test && npm run build
|
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
[](https://github.com/meodai/color-names/)
|
|
7
7
|
[](https://www.npmjs.com/package/color-name-list)
|
|
8
8
|
[](https://www.npmjs.com/package/color-name-list)
|
|
9
|
-
[](https://github.com/meodai/color-names/blob/master/src/colornames.csv)
|
|
10
10
|
[](https://github.com/sponsors/meodai)
|
|
11
11
|
|
|
12
|
-
A handpicked list of
|
|
12
|
+
A handpicked list of __30242__ unique color names from
|
|
13
13
|
[various sources](#sources-) and thousands of curated user submissions.
|
|
14
14
|
|
|
15
15
|
> The names of color function like a thread attached to a frightfully slender
|
|
@@ -23,7 +23,7 @@ A handpicked list of __30241__ unique color names from
|
|
|
23
23
|
| <a href="#usage-">Usage</a>
|
|
24
24
|
| <a href="#cdn-">CDN</a>
|
|
25
25
|
| <a href="#api-">Public Rest API</a>
|
|
26
|
-
| <a href="#usage-js-">Usage JS</a>
|
|
26
|
+
| <a href="#usage-js-">Usage JS/Java/Kotlin</a>
|
|
27
27
|
| <a href="#sources-">Name Sources</a>
|
|
28
28
|
| <a href="#latest-color-names-">Latest Color Names</a>
|
|
29
29
|
| <a href="#costs--sponsors">Sponsors</a>
|
|
@@ -54,7 +54,7 @@ __[via form 🌈](https://docs.google.com/forms/d/e/1FAIpQLSfbS5D6owA4dQupJJ-6qh
|
|
|
54
54
|
|
|
55
55
|
Make sure to read the [naming rules](CONTRIBUTING.md) before you contribute!
|
|
56
56
|
|
|
57
|
-
## Color Count:
|
|
57
|
+
## Color Count: __30242__ 🎉
|
|
58
58
|
|
|
59
59
|
~__0.18%__ of the RGB color space
|
|
60
60
|
|
|
@@ -135,12 +135,12 @@ consider using the [public rest API](#api-)
|
|
|
135
135
|
#### Exact Color
|
|
136
136
|
|
|
137
137
|
```javascript
|
|
138
|
-
import {
|
|
138
|
+
import { colornames } from 'color-name-list';
|
|
139
139
|
|
|
140
|
-
let someColor =
|
|
140
|
+
let someColor = colornames.find(color => color.hex === '#ffffff');
|
|
141
141
|
console.log(someColor.name); // => white
|
|
142
142
|
|
|
143
|
-
let someNamedColor =
|
|
143
|
+
let someNamedColor = colornames.find(color => color.name === 'Eigengrau')
|
|
144
144
|
console.log(someColor.hex); // => #16161d
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -151,10 +151,10 @@ Since there are 16777216 possible RGB colors, you might use a library such as
|
|
|
151
151
|
|
|
152
152
|
```js
|
|
153
153
|
import nearestColor from 'nearest-color';
|
|
154
|
-
import {
|
|
154
|
+
import { colornames } from 'color-name-list';
|
|
155
155
|
|
|
156
156
|
// nearestColor need objects {name => hex} as input
|
|
157
|
-
const colors =
|
|
157
|
+
const colors = colornames.reduce((o, { name, hex }) => Object.assign(o, { [name]: hex }), {});
|
|
158
158
|
|
|
159
159
|
const nearest = nearestColor.from(colors);
|
|
160
160
|
|
|
@@ -176,6 +176,63 @@ npm install && npm run build
|
|
|
176
176
|
|
|
177
177
|
See [package.json](package.json#L6) for more.
|
|
178
178
|
|
|
179
|
+
### Usage Java/Kotlin ⌨
|
|
180
|
+
|
|
181
|
+
Java/Kotlin usage is maintained through this library:
|
|
182
|
+
[UwUAroze/Color-Names](https://github.com/UwUAroze/Color-Names).
|
|
183
|
+
Additional info can be found there, but basic usage is outlined below:
|
|
184
|
+
|
|
185
|
+
#### Importing - Gradle.kts
|
|
186
|
+
|
|
187
|
+
```kts
|
|
188
|
+
repositories {
|
|
189
|
+
maven("https://jitpack.io")
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
dependencies {
|
|
193
|
+
implementation("me.aroze:color-names:1.0.2")
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### Importing - Maven
|
|
198
|
+
|
|
199
|
+
```xml
|
|
200
|
+
<repository>
|
|
201
|
+
<id>jitpack.io</id>
|
|
202
|
+
<url>https://jitpack.io</url>
|
|
203
|
+
</repository>
|
|
204
|
+
|
|
205
|
+
<dependency>
|
|
206
|
+
<groupId>me.aroze</groupId>
|
|
207
|
+
<artifactId>color-names</artifactId>
|
|
208
|
+
<version>1.0.2</version>
|
|
209
|
+
</dependency>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Closest named color - Java
|
|
213
|
+
|
|
214
|
+
```java
|
|
215
|
+
public ColorNames colorNames = new ColorNameBuilder()
|
|
216
|
+
.loadDefaults()
|
|
217
|
+
.build();
|
|
218
|
+
|
|
219
|
+
String fromHex = colorNames.getName("#facfea"); // "Classic Rose"
|
|
220
|
+
String fromRGB = colorNames.getName(224, 224, 255); // "Stoic White"
|
|
221
|
+
String fromColor = colorNames.getName(new Color(255, 219, 240)); // "Silky Pink"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Closest named color - Kotlin
|
|
225
|
+
|
|
226
|
+
```kt
|
|
227
|
+
val colorNames = ColorNameBuilder()
|
|
228
|
+
.loadDefaults()
|
|
229
|
+
.build()
|
|
230
|
+
|
|
231
|
+
val fromHex = colorNames.getName("#facfea") // "Classic Rose"
|
|
232
|
+
val fromRGB = colorNames.getName(224, 224, 255) // "Stoic White"
|
|
233
|
+
val fromColor = colorNames.getName(Color(255, 219, 240)) // "Silky Pink"
|
|
234
|
+
```
|
|
235
|
+
|
|
179
236
|
## Sources 🗒
|
|
180
237
|
|
|
181
238
|
### Sources: Names 📇
|
|
@@ -223,7 +280,7 @@ See [package.json](package.json#L6) for more.
|
|
|
223
280
|
### Sponsors
|
|
224
281
|
|
|
225
282
|
<!-- markdownlint-disable -->
|
|
226
|
-
<!-- sponsors
|
|
283
|
+
<!-- sponsors --><!-- sponsors -->
|
|
227
284
|
<!-- markdownlint-enable -->
|
|
228
285
|
|
|
229
286
|
### Past Sponsors
|
|
@@ -277,6 +334,7 @@ See [package.json](package.json#L6) for more.
|
|
|
277
334
|
, [BlueChaos]
|
|
278
335
|
, [nachtfunke]
|
|
279
336
|
, Sean Gibbons
|
|
337
|
+
, Brantley Sibo
|
|
280
338
|
|
|
281
339
|
## Disclaimer 👮🏾
|
|
282
340
|
|