Qix- / color-convert

Plain color conversion functions in JavaScript
MIT License
746 stars 96 forks source link

I want a has deleted the "," in rgb #69

Closed Zel9278 closed 5 years ago

Zel9278 commented 5 years ago

I wanted to use this in Discord.js, but the color of embed is a rgb without ",", so I want a function with "," removed.

Qix- commented 5 years ago

I have absolutely no idea what you mean. Could you explain a bit more?

Zel9278 commented 5 years ago

I have absolutely no idea what you mean. Could you explain a bit more?

I use embedding in discord.js. So I would like to add 0x000000 because it can not be used unless it is a digitization of hex value # 000000 (not RGB).

Qix- commented 5 years ago

I still don't understand. Could you show me an example?

Zel9278 commented 5 years ago

OK


            message.channel.send({
                embed: {
                    color: 00552551,
                    author: {
                        name: this.client.user.username,
                        icon_url: this.client.user.avatarURL,
                    },
                    title: "evalcommand",
                    timestamp: new Date(),
                    footer: {
                        icon_url: message.author.avatarURL,
                        text: `実行者: ${message.author.tag}`,
                    },
                    fields: [
                        {
                            name: eval(tx),
                            value: "Server Name: " + message.guild.name,
                        },
                    ],
                }
            })```

It is 00552551 of this "color: 00552551,".
It will be like this when you make it an image.
![Screenshot_20190420-104304_AnyDesk](https://user-images.githubusercontent.com/43949163/56449784-2bd30680-6359-11e9-92c6-5faa3d844aac.jpg)
Qix- commented 5 years ago

I'm really sorry but I still do not understand what it is you're trying to do :/ does discord need an integer value?

Zel9278 commented 5 years ago

Yes

Qix- commented 5 years ago
const cc = require('color-convert');
const rgb = [124, 144, 255];
const intColor = parseInt(cc.rgb.hex(...rgb), 16);
Zel9278 commented 5 years ago

Thanks

Qix- commented 5 years ago

No problem :)