Skip to main content

Convert string color for hexadecimal understandable by python

Project description

hexacolors

A simple library that converts string to hexadecimal understandable by python

Usage:

install with pip

pip install hexacolors

Import on your code:

import hexacolors
from hexacolors import hexacolor, stringcolor

Run it

hexacolors.stringcolor("Blue")
or
hexacolors.hexacolor('#711A89')

convert this string for hexadecimal understandable by python

Using in py-cord

import  discord

from discord.ext import commands
from hexacolors import hexacolor, stringcolor

intents = discord.Intents.all()

client = commands.Bot(
command_prefix = '!',
help_command = None,
case_insensitive = True,
intents = intents
)

@client.event
async def on_ready():
    print("i'm logged with {}".format(client.user))

@client.event
async def on_message(msg):
    if msg.author == client.user: return

    if msg.author.bot: return

    await client.process_commands(msg)

@client.command()
async def ping(ctx):

    ping = client.latency * 1000

    e = discord.Embed(
    title ='Ping',
    description = 'My ping is {}'.format(int(ping)),
    color = hexacolor('#2f005c')
    )

    await ctx.send(embed = e)

#or

@client.command()
async def ping(ctx):

    ping = client.latency * 1000

    e = discord.Embed(
    title ='Ping',
    description = 'My ping is {}'.format(int(ping)),
    color = stringcolor('Blue')
    )

    await ctx.send(embed = e)

client.run('Token bot here')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexacolors-0.3.1.tar.gz (7.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page