-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
45 lines (38 loc) · 1.18 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const ColorScheme = require('color-scheme')
const Color = require('color')
const Scheme = new ColorScheme
function palettes(bot, config) {
return function run(message, args) {
const color = args[0] ? args[0] : false
const variation = args[1] ? args[1] : 'default'
if(color) {
const options = {
color: color,
variation: variation
}
getHex(options, message)
} else {
message.reply('Please enter a valid color')
}
}
function getHex(options, message) {
try {
const returnedScheme = Scheme.from_hex(options.color).variation(options.variation)
let returnedColors = returnedScheme.colors()
returnedColors.unshift(options.color)
const colorString = returnedColors.join('-')
message.reply('Here is your palette: https://coolors.co/' + colorString, {
embed: {
image: {
url: 'https://coolors.co/export/png/' + colorString
}
}
})
} catch (e) {
message.reply(e)
}
}
}
palettes.command = 'palettes'
palettes.usage = 'palettes <#ff0000> <default/pastel/soft/light/hard/pale>'
module.exports = palettes;