Skip to main content

A powerful python module to set console color

Project description

Rugby

Rugby 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 Rugby, you can use pip:

pip install rugby

Usage

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

import rugby print(rugby.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 Rugby 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 Rugby, 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

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: Rugby-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 Rugby-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7311673ca47f54104d0aef8566448fec8db2c24a2e4adf25546ef20119e72c43
MD5 018b4099dcd4dd672962098bfc60d21a
BLAKE2b-256 3db9949910af8f8872122bcf6b287ecf7c0d267f037bdb9d66383fbfa206f1f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Rugby-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 Rugby-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cea09706a098ebb672dfe33deb46f3f7e2d67f8ae8bc0e188242d5b5de2bb20
MD5 cf6a7d9c10dc7e7b3a15eeb5bc641838
BLAKE2b-256 e6e9d49ae2e0ffcd0affc10aed00da53eb50c648ef342223d7ec911d1c97ecc9

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