move to tinycolor
This commit is contained in:
parent
65c9898ee5
commit
8345f5858e
4 changed files with 66 additions and 37 deletions
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"homepage": "https://gitlab.com/Cynosphere/HiddenPhox#readme",
|
||||
"dependencies": {
|
||||
"colorcolor": "^1.1.1",
|
||||
"@ctrl/tinycolor": "^3.4.1",
|
||||
"dumpy": "github:Cynosphere/dumpy.js",
|
||||
"eris": "github:abalabahaha/eris#dev",
|
||||
"google-images": "^2.1.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
lockfileVersion: 5.3
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
colorcolor: ^1.1.1
|
||||
'@ctrl/tinycolor': ^3.4.1
|
||||
dumpy: github:Cynosphere/dumpy.js
|
||||
eris: github:abalabahaha/eris#dev
|
||||
eslint: ^7.26.0
|
||||
|
@ -16,9 +16,9 @@ specifiers:
|
|||
ytdl-core: ^4.9.1
|
||||
|
||||
dependencies:
|
||||
colorcolor: 1.1.1
|
||||
'@ctrl/tinycolor': 3.4.1
|
||||
dumpy: github.com/Cynosphere/dumpy.js/5fc22353cdcb97084bab572266390e780d9f7a7b
|
||||
eris: github.com/abalabahaha/eris/cb8971a1738d603e507ec06140ccf7e246c3fc81
|
||||
eris: github.com/abalabahaha/eris/b7a118969fa1a22284d9e48bc03e7391cfafb389
|
||||
google-images: 2.1.0
|
||||
jimp: 0.16.1
|
||||
murmurhash: 2.0.0
|
||||
|
@ -58,6 +58,11 @@ packages:
|
|||
regenerator-runtime: 0.13.7
|
||||
dev: false
|
||||
|
||||
/@ctrl/tinycolor/3.4.1:
|
||||
resolution: {integrity: sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw==}
|
||||
engines: {node: '>=10'}
|
||||
dev: false
|
||||
|
||||
/@eslint/eslintrc/0.4.1:
|
||||
resolution: {integrity: sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ==}
|
||||
engines: {node: ^10.12.0 || >=12.0.0}
|
||||
|
@ -173,7 +178,7 @@ packages:
|
|||
tinycolor2: 1.4.2
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-contain/0.16.1_38e919e7cde018834207f15ee7b0ce6a:
|
||||
/@jimp/plugin-contain/0.16.1_hdurtz6n4amigqqh6fpopmgoni:
|
||||
resolution: {integrity: sha512-44F3dUIjBDHN+Ym/vEfg+jtjMjAqd2uw9nssN67/n4FdpuZUVs7E7wadKY1RRNuJO+WgcD5aDQcsvurXMETQTg==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -185,11 +190,11 @@ packages:
|
|||
'@jimp/custom': 0.16.1
|
||||
'@jimp/plugin-blit': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-resize': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-scale': 0.16.1_c382371bb4f60ea2fd211a04ed8ab1e2
|
||||
'@jimp/plugin-scale': 0.16.1_yobdog5u6yhkf7jbdico3cvr4i
|
||||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-cover/0.16.1_3d13feed36f5fd86198de47b78b25314:
|
||||
/@jimp/plugin-cover/0.16.1_huj753jw6x6ymgmn4r5xrmstcq:
|
||||
resolution: {integrity: sha512-YztWCIldBAVo0zxcQXR+a/uk3/TtYnpKU2CanOPJ7baIuDlWPsG+YE4xTsswZZc12H9Kl7CiziEbDtvF9kwA/Q==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -201,7 +206,7 @@ packages:
|
|||
'@jimp/custom': 0.16.1
|
||||
'@jimp/plugin-crop': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-resize': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-scale': 0.16.1_c382371bb4f60ea2fd211a04ed8ab1e2
|
||||
'@jimp/plugin-scale': 0.16.1_yobdog5u6yhkf7jbdico3cvr4i
|
||||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
|
@ -245,7 +250,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-flip/0.16.1_205f1d9ec51496ff93f52ac5618c3660:
|
||||
/@jimp/plugin-flip/0.16.1_ebpr3hwfcslp7e7vflcwddbwma:
|
||||
resolution: {integrity: sha512-KdxTf0zErfZ8DyHkImDTnQBuHby+a5YFdoKI/G3GpBl3qxLBvC+PWkS2F/iN3H7wszP7/TKxTEvWL927pypT0w==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -253,7 +258,7 @@ packages:
|
|||
dependencies:
|
||||
'@babel/runtime': 7.14.0
|
||||
'@jimp/custom': 0.16.1
|
||||
'@jimp/plugin-rotate': 0.16.1_37f4bc9bbdbf41c03b931ee8408b3361
|
||||
'@jimp/plugin-rotate': 0.16.1_g72lzg55x5a4ao4td3uebcztme
|
||||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
|
@ -297,7 +302,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-print/0.16.1_5191b610a3eb861d3baa10a735e89ecc:
|
||||
/@jimp/plugin-print/0.16.1_kgi3mefd5odb2o5kccttl2e6zq:
|
||||
resolution: {integrity: sha512-ceWgYN40jbN4cWRxixym+csyVymvrryuKBQ+zoIvN5iE6OyS+2d7Mn4zlNgumSczb9GGyZZESIgVcBDA1ezq0Q==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -320,7 +325,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-rotate/0.16.1_37f4bc9bbdbf41c03b931ee8408b3361:
|
||||
/@jimp/plugin-rotate/0.16.1_g72lzg55x5a4ao4td3uebcztme:
|
||||
resolution: {integrity: sha512-ZUU415gDQ0VjYutmVgAYYxC9Og9ixu2jAGMCU54mSMfuIlmohYfwARQmI7h4QB84M76c9hVLdONWjuo+rip/zg==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -336,7 +341,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-scale/0.16.1_c382371bb4f60ea2fd211a04ed8ab1e2:
|
||||
/@jimp/plugin-scale/0.16.1_yobdog5u6yhkf7jbdico3cvr4i:
|
||||
resolution: {integrity: sha512-jM2QlgThIDIc4rcyughD5O7sOYezxdafg/2Xtd1csfK3z6fba3asxDwthqPZAgitrLgiKBDp6XfzC07Y/CefUw==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -348,7 +353,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-shadow/0.16.1_82540ab48d5f83680494f34d0dac907f:
|
||||
/@jimp/plugin-shadow/0.16.1_qjkavnenl6bwqbeu6ngq3leqp4:
|
||||
resolution: {integrity: sha512-MeD2Is17oKzXLnsphAa1sDstTu6nxscugxAEk3ji0GV1FohCvpHBcec0nAq6/czg4WzqfDts+fcPfC79qWmqrA==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -362,7 +367,7 @@ packages:
|
|||
'@jimp/utils': 0.16.1
|
||||
dev: false
|
||||
|
||||
/@jimp/plugin-threshold/0.16.1_ec0c83f3603149a8780f87045f821922:
|
||||
/@jimp/plugin-threshold/0.16.1_5qgih43agfe2q6apq4cf7aqzei:
|
||||
resolution: {integrity: sha512-iGW8U/wiCSR0+6syrPioVGoSzQFt4Z91SsCRbgNKTAk7D+XQv6OI78jvvYg4o0c2FOlwGhqz147HZV5utoSLxA==}
|
||||
peerDependencies:
|
||||
'@jimp/custom': '>=0.3.5'
|
||||
|
@ -387,23 +392,23 @@ packages:
|
|||
'@jimp/plugin-blur': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-circle': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-color': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-contain': 0.16.1_38e919e7cde018834207f15ee7b0ce6a
|
||||
'@jimp/plugin-cover': 0.16.1_3d13feed36f5fd86198de47b78b25314
|
||||
'@jimp/plugin-contain': 0.16.1_hdurtz6n4amigqqh6fpopmgoni
|
||||
'@jimp/plugin-cover': 0.16.1_huj753jw6x6ymgmn4r5xrmstcq
|
||||
'@jimp/plugin-crop': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-displace': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-dither': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-fisheye': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-flip': 0.16.1_205f1d9ec51496ff93f52ac5618c3660
|
||||
'@jimp/plugin-flip': 0.16.1_ebpr3hwfcslp7e7vflcwddbwma
|
||||
'@jimp/plugin-gaussian': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-invert': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-mask': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-normalize': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-print': 0.16.1_5191b610a3eb861d3baa10a735e89ecc
|
||||
'@jimp/plugin-print': 0.16.1_kgi3mefd5odb2o5kccttl2e6zq
|
||||
'@jimp/plugin-resize': 0.16.1_@jimp+custom@0.16.1
|
||||
'@jimp/plugin-rotate': 0.16.1_37f4bc9bbdbf41c03b931ee8408b3361
|
||||
'@jimp/plugin-scale': 0.16.1_c382371bb4f60ea2fd211a04ed8ab1e2
|
||||
'@jimp/plugin-shadow': 0.16.1_82540ab48d5f83680494f34d0dac907f
|
||||
'@jimp/plugin-threshold': 0.16.1_ec0c83f3603149a8780f87045f821922
|
||||
'@jimp/plugin-rotate': 0.16.1_g72lzg55x5a4ao4td3uebcztme
|
||||
'@jimp/plugin-scale': 0.16.1_yobdog5u6yhkf7jbdico3cvr4i
|
||||
'@jimp/plugin-shadow': 0.16.1_qjkavnenl6bwqbeu6ngq3leqp4
|
||||
'@jimp/plugin-threshold': 0.16.1_5qgih43agfe2q6apq4cf7aqzei
|
||||
timm: 1.7.1
|
||||
dev: false
|
||||
|
||||
|
@ -450,6 +455,22 @@ packages:
|
|||
regenerator-runtime: 0.13.7
|
||||
dev: false
|
||||
|
||||
/@types/keyv/3.1.4:
|
||||
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.35
|
||||
dev: false
|
||||
|
||||
/@types/node/17.0.35:
|
||||
resolution: {integrity: sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==}
|
||||
dev: false
|
||||
|
||||
/@types/responselike/1.0.0:
|
||||
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.35
|
||||
dev: false
|
||||
|
||||
/abbrev/1.1.1:
|
||||
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
|
||||
dev: false
|
||||
|
@ -693,12 +714,6 @@ packages:
|
|||
color-string: 1.6.0
|
||||
dev: false
|
||||
|
||||
/colorcolor/1.1.1:
|
||||
resolution: {integrity: sha1-X34sRbCj2A1JKOCN9I6V/ck0RMU=}
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
dev: false
|
||||
|
||||
/combined-stream/1.0.8:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
@ -744,6 +759,11 @@ packages:
|
|||
|
||||
/debug/3.2.7:
|
||||
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
dev: false
|
||||
|
@ -1146,6 +1166,8 @@ packages:
|
|||
resolution: {integrity: sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
'@types/keyv': 3.1.4
|
||||
'@types/responselike': 1.0.0
|
||||
create-error-class: 3.0.2
|
||||
duplexer3: 0.1.4
|
||||
get-stream: 3.0.0
|
||||
|
@ -1525,6 +1547,8 @@ packages:
|
|||
debug: 3.2.7
|
||||
iconv-lite: 0.4.24
|
||||
sax: 1.2.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/node-abi/2.30.0:
|
||||
|
@ -1551,6 +1575,7 @@ packages:
|
|||
resolution: {integrity: sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
fstream: 1.0.12
|
||||
glob: 7.1.7
|
||||
|
@ -1582,6 +1607,8 @@ packages:
|
|||
rimraf: 2.7.1
|
||||
semver: 5.7.1
|
||||
tar: 4.4.14
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/nopt/3.0.6:
|
||||
|
@ -2030,6 +2057,8 @@ packages:
|
|||
node-pre-gyp: 0.11.0
|
||||
optionalDependencies:
|
||||
node-gyp: 3.8.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/sshpk/1.16.1:
|
||||
|
@ -2378,8 +2407,8 @@ packages:
|
|||
node-fetch: 2.6.1
|
||||
dev: false
|
||||
|
||||
github.com/abalabahaha/eris/cb8971a1738d603e507ec06140ccf7e246c3fc81:
|
||||
resolution: {tarball: https://codeload.github.com/abalabahaha/eris/tar.gz/cb8971a1738d603e507ec06140ccf7e246c3fc81}
|
||||
github.com/abalabahaha/eris/b7a118969fa1a22284d9e48bc03e7391cfafb389:
|
||||
resolution: {tarball: https://codeload.github.com/abalabahaha/eris/tar.gz/b7a118969fa1a22284d9e48bc03e7391cfafb389}
|
||||
name: eris
|
||||
version: 0.16.2-dev
|
||||
engines: {node: '>=10.4.0'}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const Eris = require("eris");
|
||||
const murmurhash = require("murmurhash").v3;
|
||||
const colorcolor = require("colorcolor");
|
||||
const {tinycolor} = require("@ctrl/tinycolor");
|
||||
const fetch = require("node-fetch");
|
||||
|
||||
function pastelize(id) {
|
||||
const hue = murmurhash(id) % 360;
|
||||
const hex = colorcolor(`hsl(${hue},75%,60%)`, "hex");
|
||||
return parseInt(hex.substring(1), 16);
|
||||
const hex = tinycolor(`hsl(${hue},75%,60%)`).toHex();
|
||||
return parseInt(hex, 16);
|
||||
}
|
||||
|
||||
function getTopColor(msg, id, fallback = 0x7289da) {
|
||||
|
|
|
@ -2,7 +2,7 @@ const Command = require("../lib/command.js");
|
|||
const CATEGORY = "misc";
|
||||
|
||||
const fetch = require("node-fetch");
|
||||
const colorcolor = require("colorcolor");
|
||||
const {tinycolor} = require("@ctrl/tinycolor");
|
||||
|
||||
// taken from rot13.com
|
||||
function rot(s, i) {
|
||||
|
@ -31,7 +31,7 @@ utsuholights.callback = async function (msg, line, hex, bri) {
|
|||
return "Could not determine hex color.";
|
||||
}
|
||||
|
||||
const [_, r, g, b] = colorcolor(hex, "rgb").match(/rgb\((\d+),(\d+),(\d+)\)/);
|
||||
const {r, g, b} = tinycolor(hex).toRgb();
|
||||
|
||||
if (!cachedLightsURL) {
|
||||
cachedLightsURL = Buffer.from(rot(LIGHTS_URL, 13), "base64").toString(); // Wow! It's That Easy!
|
||||
|
|
Loading…
Reference in a new issue