Skip to main content

A powerful python module to set console color

Project description

Colorad

Colorad is a powerful Python module that allows you to set console colors in your Python applications. With this module, you can add color and style to the text displayed on the terminal/command prompt.

Installation

To install Colorad, you can use pip:

pip install colorad

Usage

To use Colorad, you can import the module and use its functions as shown in the following example:

import colorad print(colorad.colorize(255, [100],1) + "hi")

In this example, the colorize() function is used to print "hi" in a specific color with a weight of 1. The fgcolor() and bgcolor() functions can also be used to set the foreground and background colors separately, and the uncolor() function can be used to reset the console color to its default setting.

Functions

The following functions are available in the Colorad module:

  • colorize(fgcolor, bgcolor, weight=0): Returns the color code for a specific combination of foreground and background colors with a specified weight.
  • fgcolor(fgcolor): Returns the color code for a specific foreground color.
  • bgcolor(bgcolor): Returns the color code for a specific background color.
  • uncolor(): Resets the console color to its default setting.

Input Formats

The following functions are available in this module:

  • colorize
  • fgcolor
  • bgcolor
  • uncolor

colorize

The colorize function takes three arguments: fgcolor, bgcolor, and weight.

The fgcolor and bgcolor arguments specify the foreground and background colors for the output text, respectively. These arguments can be either RGB values or color names.

Accepted RGB values are arrays of three integers representing the red, green, and blue values for the desired color.

The weight argument specifies the weight (or intensity) of the text. It should be an integer between 0 and 99, with higher values indicating bolder text. The default value is 0.

fgcolor and bgcolor

These functions are simpler versions of colorize. They each take one argument, which is the color for the foreground or background, respectively. The format of this argument is the same as for fgcolor and bgcolor in colorize.

uncolor

The uncolor function returns the escape code to reset the terminal color back to its default value.

  • colorize
  • fgcolor
  • bgcolor
  • uncolor

Predetermined color

These variables are values that you can call predefined colors by calling them inner colorize(), fgcolor() & bgcolor():

  • red = [205,0,0]
  • green = (0,205,0)
  • white = (255,255,255)
  • black = (0,0,0)
  • gray = (50,50,50)
  • blue = (0,0,205)
  • yellow = (255, 230, 0)
  • magenra = (255,0,255)
  • cyan = (0,255,255)

For more information on how to use these functions, please refer to the documentation on Hamidreza Ahmadi's GitHub page.

Conclusion

With Colorad, you can easily add color and style to the text displayed on the terminal/command prompt in your Python applications. This module is easy to use and highly customizable, making it a great choice for developers who want to create eye-catching console interfaces.

قاعدتا وقتی دنبال همچین چیزی میاین قبلا colorama رو سر زدین بهش ، خب colorama بلد نیست رنگ های rgb بده ولی این میتونه همچین کاری کنه ! همین ! یا یسری تنظیمات دیگه که خب تو بالا نوشتمشون چطوری باید باهاشون کار کنین

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

Colorad-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

Colorad-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file Colorad-0.1.0.tar.gz.

File metadata

  • Download URL: Colorad-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for Colorad-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8569d542d3437419b387d5b6888fdf88f9cbd34b1eb3f186ab0a0c2f388b668b
MD5 bf6ab98080327d5947100969380330eb
BLAKE2b-256 2c4f35e353dbdfce16bc2144037f50886e2a1e04fd0ec9bf2cca3b5fc94afafb

See more details on using hashes here.

File details

Details for the file Colorad-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: Colorad-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for Colorad-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b322330337c0c900c71e5c91ca3512e00d3139108bbe15928ebc531e4f650b6
MD5 0f48e7e4f23cdfc93be29199ea17e6c2
BLAKE2b-256 e730234767e97a2a6f8ef33e1ba68b524e6256ee9186caa5428d8789d958da35

See more details on using hashes here.

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