rong


Namerong JSON
Version 0.0.3 PyPI version JSON
download
home_page
SummaryA coloring utility for Python console apps.
upload_time2024-03-11 18:53:48
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2022-present Md. Almas Ali Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords background color colored coloring colour console foreground formatting rgb rong style terminal text utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# Rong

**A coloring utility for Python console apps.**

**Developed by [Md. Almas Ali][1]**

<img src="https://raw.githubusercontent.com/Almas-Ali/rong/master/logo.png" alt="Rong" width="350" height="350">

[![PyPI](https://img.shields.io/pypi/v/rong?color=blue&label=PyPI&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "PyPI")
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rong?color=blue&label=Python&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "Python Version")
[![PyPI - Downloads](https://img.shields.io/pypi/dm/rong?color=blue&label=Downloads&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "Downloads")
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/rong?color=blue&label=Wheel&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "Wheel")
[![PyPI - Status](https://img.shields.io/pypi/status/rong?color=blue&label=Status&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "Status")
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/rong?color=blue&label=Implementation&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "Implementation")
[![PyPI - License](https://img.shields.io/pypi/l/rong?color=blue&label=License&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ "License")
[![GitHub](https://img.shields.io/badge/Almas-Ali-blue?style=for-the-badge&logo=github)][1]

<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FAlmas-Ali%2Frong&count_bg=%2352B308&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>

</div>

## Table of contents

- [Introduction](#introduction)
- [Installation and uninstallation](#installation-and-uninstallation)
- [Getting started](#getting-started)
- [Colors and Styles](#colors-and-styles)
- [Log class](#log-class)
  - [Log Example](#log-example)
- [Highlight class](#highlight-class)
  - [Highlight Example](#highlight-example)
- [Text class](#text-class)
  - [Text Example](#text-example)
- [Random methods](#random-methods)
  - [Random Example](#random-example)
- [All Examples](#all-examples)
  - [Output Screenshot](#output-screenshot)
- [Change History](#change-history)
- [License](#license)
- [Contributing](#contributing)

## Introduction

Rong is a simple and easy to use Python module to colorize text in the console. It is a simple and easy to use module. It is a very lightweight, fast and reliable module. We are ensuring it's reliability by writting `unittest` for it.

> [!NOTE]
> Please let me know if you have any suggestions or improvements.

## Installation and uninstallation

It is very easy to install. Like as usual you can install it with `pip`.

```bash
pip install rong
```

You can also install it from source, if your very curious about the source code.

```bash
# Clone the Github repository
git clone https://github.com/Almas-Ali/rong

# Go to the project directory
cd rong

# Create virtual environment
python -m venv .venv

# Activate virtual environment (Windows)
.venv\Scripts\activate

# Activate virtual environment (Linux)
source .venv/bin/activate

# Install the package
pip install -e .
```

Your ready to go with this module now.

To uninstall this just simple use this `pip` command.

`pip uninstall rong`

Is that simple to install and uninstall this module.

## Getting started

This is the most easiest way to use this module. You can use this module in your project by importing it. Here is a simple example to use this module.

```python
import rong

log = rong.Log(debug=False)

text = rong.Text(
    log.errormsg("Something went wrong! Please try again."),
    fg=rong.ForegroundColor.VIOLET,
    bg=rong.BackgroundColor.TRANSPARENT,
    styles=[rong.Style.BOLD, rong.Style.UNDERLINE_WAVY, rong.Style.BLINK],
)

text.print()
```

This is the most easiest example to get started with this module.

## Colors and Styles

After a huge headache, I have decided to use `Enum` class to make it more reliable and easy to use. Here is the example to use this module.

```python
from rong import (
	ForegroundColor,
	BackgroundColor,
	Style,
	Text,
)

text = Text(
	# Text to display
	"Hello World!",
	# Red color in foreground
	fg=ForegroundColor.RED,
	# Light green color in background
	bg=BackgroundColor.LIGHTGREEN,
	# Adding multiple styles. Bold, underline wavy and blinking text
	styles=[Style.BOLD, Style.UNDERLINE_WAVY, Style.BLINK],
)

print(text)
```

**All `ForegroundColor`s are listed here:**

- `BLACK`
- `RED`
- `GREEN`
- `YELLOW`
- `BLUE`
- `PURPLE`
- `CYAN`
- `WHITE`
- `ORANGE`
- `TOMATO`
- `PINK`
- `VIOLET`
- `GRAY`
- `DARKGREEN`
- `GOLD`
- `YELLOWGREEN`
- `LIGHTGRAY`
- `LIGHTBLUE`
- `LIGHTGREEN`
- `LIGHTYELLOW`
- `LIGHTPURPLE`
- `LIGHTCYAN`
- `LIGHTWHITE`
- `LIGHTSEAGREEN`
- `LIGHTRED`
- `LIGHTPINK`
- `LIGHTORANGE`
- `LIGHTVIOLET`
- `TRANSPARENT`

**All `BackgroundColor`s are listed here:**

- `BLACK`
- `RED`
- `GREEN`
- `YELLOW`
- `BLUE`
- `PURPLE`
- `CYAN`
- `WHITE`
- `ORANGE`
- `TOMATO`
- `PINK`
- `VIOLET`
- `GRAY`
- `DARKGREEN`
- `GOLD`
- `YELLOWGREEN`
- `LIGHTGRAY`
- `LIGHTBLUE`
- `LIGHTGREEN`
- `LIGHTYELLOW`
- `LIGHTPURPLE`
- `LIGHTCYAN`
- `LIGHTWHITE`
- `LIGHTSEAGREEN`
- `LIGHTRED`
- `LIGHTPINK`
- `LIGHTORANGE`
- `LIGHTVIOLET`
- `TRANSPARENT`

**All `Style`s are listed here:**

- `BLINK`
- `BOLD`
- `CLEAR`
- `CONCEALED`
- `INVISIBLE`
- `ITALIC`
- `OVERLINE`
- `REVERSE`
- `STRIKE`
- `DIM`
- `UNDERLINE`
- `UNDERLINE_SOLID`
- `UNDERLINE_WAVY`
- `UNDERLINE_DOTTED`
- `UNDERLINE_DOUBLE`
- `UNDERLINE_DASHED`

- **NOTE :**
  1. You can use `clear` to clear all setted styles.
  2. When you use `underline` it will be `underline-solid` by default.
  3. `underline-wavy`, `underline-dotted` and `underline-dashed` underline is not supported in all terminals.

## Log class

`rong.Log` is a simple logging text class for coloring text. It has a parameter `debug` which is `True` by default. If you set it to `False` it will not print any output rather than it will return the output as a string. After creating an object of this class you can use the following methods to display text.

- To display primary text `primary(text:str)`

- To display blue text `blue(text:str)`

- To display success text `success(text:str)`

- To display green text `green(text:str)`

- To display ok text `ok(text:str)`

- To display warning text `warning(text:str)`

- To display yellow text `yellow(text:str)`

- To display help text `help(text:str)`

- To display danger text `danger(text:str)`

- To display error text `error(text:str)`

- To display fail message `fail(text:str)`

- To display underline `underline(text:str)`

- To display bold text `bold(text:str)`

- To display ok message `okmsg(text:str)`

- To display wait message `waitmsg(text:str)`

- To display error message `errormsg(text:str)`

### Log Example

```python
from rong import Log

log = Log() # debug=True by default

log.okmsg("Everything is ok")
log.waitmsg("Please wait")
log.errormsg("Something went wrong")
```

If debug is set to `False` then it will return the output as a string.

```python
from rong import Log

log = Log(debug=False)

log.okmsg("Everything is ok")
log.waitmsg("Please wait")
log.errormsg("Something went wrong")
```

Now, you won't see any output in the console rather than it will return the output as a string. You can use this string as you want. You can print it manually or you can save it in a file. It is used to debug applications business logic.

## Highlight class

`rong.Highlight` is a class for highlighing text color. It is a inline usable class. You can use this class to highlight text in a single line. It has the following methods to highlight text.

- To get white color `white(text:str)`

- To get bold white color `bwhite(text:str)`

- To get green color `green(text:str)`

- To get bold green color `bgreen(text:str)`

- To get blue color `blue(text:str)`

- To get bold blue color `bblue(text:str)`

- To get yellow color `yellow(text:str)`

- To get bold yellow color `byellow(text:str)`

- To get red color `red(text:str)`

- To get bold red color `bred(text:str)`

### Highlight Example

```python
from rong import Highlight

print(Highlight.red("This is a red text"))
print(Highlight.bred("This is a bold red text"))
print(Highlight.blue("This is a blue text"))
print(Highlight.bblue("This is a bold blue text"))
print(Highlight.yellow("This is a yellow text"))

print(f"This is a {Highlight.green('green')} text")
print(f"This is a {Highlight.bgreen('bold green')} text")
```

## Text class

Most powerfull class in this module is `rong.Text`. It is used to create a text object with different styles and colors. It has the following methods to create a text object.

- `foreground(color: ForegroundColor) -> Text`

- `background(color: BackgroundColor) -> Text`

- `style(styles: List[Style]) -> str`

- `update(text: str) -> Text`

- `print() -> None`

You can dynamically add colors and styles to the text object with this methods. It is also possible to update the text of the object. You can print the output with `print` method. Normal `print(text)` also works same as `text.print()`.

### Text Example

```python
import rong

log = rong.Log(debug=False)

text = rong.Text(
    log.errormsg("Something went wrong! Please try again."),
    fg=rong.ForegroundColor.VIOLET,
    bg=rong.BackgroundColor.TRANSPARENT,
    styles=[rong.Style.BOLD, rong.Style.UNDERLINE_WAVY, rong.Style.BLINK],
)

text.print()
```

Here, in this example we have created a text object with a error message and added some styles and colors. Then we have printed the output.

## Random methods

`rong` module has some random methods to get `ForegroundColor`, `BackgroundColor` and `Style` to make it more easy to use. Here is the example to use this module.

### Random Example

```python
from rong import (
	get_random_background_color,
	get_random_foreground_color,
	get_random_style,
)

print(get_random_background_color())
print(get_random_foreground_color())
print(get_random_style())
```

You can use this methods with `Text` class to get random colors and styles.

```python
from rong import (
	get_random_background_color,
	get_random_foreground_color,
	get_random_style,
	Text,
)

text = Text(
	"Hello World!",
	fg=get_random_foreground_color(),
	bg=get_random_background_color(),
	styles=[get_random_style()],
)

print(text)
```

## All Examples

Here is the all examples to use this module.

```python
from rong import *

# In line Log display
log = Log(debug=False)
print(f"This is a {log.primary('sample')} test.")
print(f"This is a {log.waitmsg('sample')} test.")
print(f"This is a {log.errormsg('sample')} test.")
print(f"This is a {log.warning('sample')} test.")

# Normal log
log = Log()  # debug=True by default
log.waitmsg('Please wait...')
log.errormsg('Something went wrong! Please try again.')
log.warning('This is a warning message.')
log.primary('This is a primary message.')


# In line text highlighting
print(f"This is a {Highlight.red('sample')} test.")
print(f"This is a {Highlight.bred('sample')} test.")
print(f"This is a {Highlight.blue('sample')} test.")
print(f"This is a {Highlight.bblue('sample')} test.")
print(f"This is a {Highlight.yellow('sample')} test.")
print(f"This is a {Highlight.byellow('sample')} test.")


# Working with Text objects
# Creating Text class object
text = Text(text='Sample Text')

# Adding forground color / text color
text.foreground(ForegroundColor.BLUE)
text.foreground(ForegroundColor.PURPLE)

# Adding background color
text.background(BackgroundColor.WHITE)

# Adding custom styles
text.style(styles=[Style.BOLD, Style.UNDERLINE])

# Updating object text
text.update(text=' New text ')

# Printing output in two ways
# Advance methode bashed mode
text.print()
# Normal pythonic mode
print(text)

# Doing everything in one line
text1 = Text(
    text='Demo1',
    fg=ForegroundColor.BLUE,
    bg=BackgroundColor.WHITE,
    styles=[Style.BOLD],
)
text1.print()

# Clearing all styles
text2 = Text(text='Demo', styles=[Style.CLEAR])
text2.print()


# Random methods. This return random Enum class object of ForegroundColor, BackgroundColor and Style.
print(get_random_background_color())
print(get_random_foreground_color())
print(get_random_style())

text3 = Text(
	"Hello World!",
	fg=get_random_foreground_color(),
	bg=get_random_background_color(),
	styles=[get_random_style()],
)

print(text3)
```

### Output Screenshot

![Screenshot](https://raw.githubusercontent.com/Almas-Ali/rong/master/screenshot-1.png "Output Screenshot")

## Change History

**0.0.3** - Updated color and style with `Enum` class. Added `unittest` for more reliability. Refactored hole code base.

**0.0.2** - Fixed default background issue, added huge amonut of colors and styles varient. Added more examples and documentation.

**0.0.1** - Initialized this project and written all this codes.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Contributing

> [!IMPORTANT]
> Everything is open source. You can contribute in this project by submitting a issue or fixing a problem and make pull request.

Made with love by © [**_Md. Almas Ali_**][1]

[1]: https://github.com/Almas-Ali "Md. Almas Ali"

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "rong",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "\"Md. Almas Ali\" <almaspr3@gmail.com>",
    "keywords": "background,color,colored,coloring,colour,console,foreground,formatting,rgb,rong,style,terminal,text,utility",
    "author": "",
    "author_email": "\"Md. Almas Ali\" <almaspr3@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3a/74/52fbd76dbd050c5a381bea9af09730a1c8c600446e89dafb9789905ceaa6/rong-0.0.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# Rong\n\n**A coloring utility for Python console apps.**\n\n**Developed by [Md. Almas Ali][1]**\n\n<img src=\"https://raw.githubusercontent.com/Almas-Ali/rong/master/logo.png\" alt=\"Rong\" width=\"350\" height=\"350\">\n\n[![PyPI](https://img.shields.io/pypi/v/rong?color=blue&label=PyPI&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"PyPI\")\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rong?color=blue&label=Python&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"Python Version\")\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/rong?color=blue&label=Downloads&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"Downloads\")\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/rong?color=blue&label=Wheel&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"Wheel\")\n[![PyPI - Status](https://img.shields.io/pypi/status/rong?color=blue&label=Status&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"Status\")\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/rong?color=blue&label=Implementation&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"Implementation\")\n[![PyPI - License](https://img.shields.io/pypi/l/rong?color=blue&label=License&logo=python&style=for-the-badge)](https://pypi.org/project/rong/ \"License\")\n[![GitHub](https://img.shields.io/badge/Almas-Ali-blue?style=for-the-badge&logo=github)][1]\n\n<a href=\"https://hits.seeyoufarm.com\"><img src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FAlmas-Ali%2Frong&count_bg=%2352B308&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false\"/></a>\n\n</div>\n\n## Table of contents\n\n- [Introduction](#introduction)\n- [Installation and uninstallation](#installation-and-uninstallation)\n- [Getting started](#getting-started)\n- [Colors and Styles](#colors-and-styles)\n- [Log class](#log-class)\n  - [Log Example](#log-example)\n- [Highlight class](#highlight-class)\n  - [Highlight Example](#highlight-example)\n- [Text class](#text-class)\n  - [Text Example](#text-example)\n- [Random methods](#random-methods)\n  - [Random Example](#random-example)\n- [All Examples](#all-examples)\n  - [Output Screenshot](#output-screenshot)\n- [Change History](#change-history)\n- [License](#license)\n- [Contributing](#contributing)\n\n## Introduction\n\nRong is a simple and easy to use Python module to colorize text in the console. It is a simple and easy to use module. It is a very lightweight, fast and reliable module. We are ensuring it's reliability by writting `unittest` for it.\n\n> [!NOTE]\n> Please let me know if you have any suggestions or improvements.\n\n## Installation and uninstallation\n\nIt is very easy to install. Like as usual you can install it with `pip`.\n\n```bash\npip install rong\n```\n\nYou can also install it from source, if your very curious about the source code.\n\n```bash\n# Clone the Github repository\ngit clone https://github.com/Almas-Ali/rong\n\n# Go to the project directory\ncd rong\n\n# Create virtual environment\npython -m venv .venv\n\n# Activate virtual environment (Windows)\n.venv\\Scripts\\activate\n\n# Activate virtual environment (Linux)\nsource .venv/bin/activate\n\n# Install the package\npip install -e .\n```\n\nYour ready to go with this module now.\n\nTo uninstall this just simple use this `pip` command.\n\n`pip uninstall rong`\n\nIs that simple to install and uninstall this module.\n\n## Getting started\n\nThis is the most easiest way to use this module. You can use this module in your project by importing it. Here is a simple example to use this module.\n\n```python\nimport rong\n\nlog = rong.Log(debug=False)\n\ntext = rong.Text(\n    log.errormsg(\"Something went wrong! Please try again.\"),\n    fg=rong.ForegroundColor.VIOLET,\n    bg=rong.BackgroundColor.TRANSPARENT,\n    styles=[rong.Style.BOLD, rong.Style.UNDERLINE_WAVY, rong.Style.BLINK],\n)\n\ntext.print()\n```\n\nThis is the most easiest example to get started with this module.\n\n## Colors and Styles\n\nAfter a huge headache, I have decided to use `Enum` class to make it more reliable and easy to use. Here is the example to use this module.\n\n```python\nfrom rong import (\n\tForegroundColor,\n\tBackgroundColor,\n\tStyle,\n\tText,\n)\n\ntext = Text(\n\t# Text to display\n\t\"Hello World!\",\n\t# Red color in foreground\n\tfg=ForegroundColor.RED,\n\t# Light green color in background\n\tbg=BackgroundColor.LIGHTGREEN,\n\t# Adding multiple styles. Bold, underline wavy and blinking text\n\tstyles=[Style.BOLD, Style.UNDERLINE_WAVY, Style.BLINK],\n)\n\nprint(text)\n```\n\n**All `ForegroundColor`s are listed here:**\n\n- `BLACK`\n- `RED`\n- `GREEN`\n- `YELLOW`\n- `BLUE`\n- `PURPLE`\n- `CYAN`\n- `WHITE`\n- `ORANGE`\n- `TOMATO`\n- `PINK`\n- `VIOLET`\n- `GRAY`\n- `DARKGREEN`\n- `GOLD`\n- `YELLOWGREEN`\n- `LIGHTGRAY`\n- `LIGHTBLUE`\n- `LIGHTGREEN`\n- `LIGHTYELLOW`\n- `LIGHTPURPLE`\n- `LIGHTCYAN`\n- `LIGHTWHITE`\n- `LIGHTSEAGREEN`\n- `LIGHTRED`\n- `LIGHTPINK`\n- `LIGHTORANGE`\n- `LIGHTVIOLET`\n- `TRANSPARENT`\n\n**All `BackgroundColor`s are listed here:**\n\n- `BLACK`\n- `RED`\n- `GREEN`\n- `YELLOW`\n- `BLUE`\n- `PURPLE`\n- `CYAN`\n- `WHITE`\n- `ORANGE`\n- `TOMATO`\n- `PINK`\n- `VIOLET`\n- `GRAY`\n- `DARKGREEN`\n- `GOLD`\n- `YELLOWGREEN`\n- `LIGHTGRAY`\n- `LIGHTBLUE`\n- `LIGHTGREEN`\n- `LIGHTYELLOW`\n- `LIGHTPURPLE`\n- `LIGHTCYAN`\n- `LIGHTWHITE`\n- `LIGHTSEAGREEN`\n- `LIGHTRED`\n- `LIGHTPINK`\n- `LIGHTORANGE`\n- `LIGHTVIOLET`\n- `TRANSPARENT`\n\n**All `Style`s are listed here:**\n\n- `BLINK`\n- `BOLD`\n- `CLEAR`\n- `CONCEALED`\n- `INVISIBLE`\n- `ITALIC`\n- `OVERLINE`\n- `REVERSE`\n- `STRIKE`\n- `DIM`\n- `UNDERLINE`\n- `UNDERLINE_SOLID`\n- `UNDERLINE_WAVY`\n- `UNDERLINE_DOTTED`\n- `UNDERLINE_DOUBLE`\n- `UNDERLINE_DASHED`\n\n- **NOTE :**\n  1. You can use `clear` to clear all setted styles.\n  2. When you use `underline` it will be `underline-solid` by default.\n  3. `underline-wavy`, `underline-dotted` and `underline-dashed` underline is not supported in all terminals.\n\n## Log class\n\n`rong.Log` is a simple logging text class for coloring text. It has a parameter `debug` which is `True` by default. If you set it to `False` it will not print any output rather than it will return the output as a string. After creating an object of this class you can use the following methods to display text.\n\n- To display primary text `primary(text:str)`\n\n- To display blue text `blue(text:str)`\n\n- To display success text `success(text:str)`\n\n- To display green text `green(text:str)`\n\n- To display ok text `ok(text:str)`\n\n- To display warning text `warning(text:str)`\n\n- To display yellow text `yellow(text:str)`\n\n- To display help text `help(text:str)`\n\n- To display danger text `danger(text:str)`\n\n- To display error text `error(text:str)`\n\n- To display fail message `fail(text:str)`\n\n- To display underline `underline(text:str)`\n\n- To display bold text `bold(text:str)`\n\n- To display ok message `okmsg(text:str)`\n\n- To display wait message `waitmsg(text:str)`\n\n- To display error message `errormsg(text:str)`\n\n### Log Example\n\n```python\nfrom rong import Log\n\nlog = Log() # debug=True by default\n\nlog.okmsg(\"Everything is ok\")\nlog.waitmsg(\"Please wait\")\nlog.errormsg(\"Something went wrong\")\n```\n\nIf debug is set to `False` then it will return the output as a string.\n\n```python\nfrom rong import Log\n\nlog = Log(debug=False)\n\nlog.okmsg(\"Everything is ok\")\nlog.waitmsg(\"Please wait\")\nlog.errormsg(\"Something went wrong\")\n```\n\nNow, you won't see any output in the console rather than it will return the output as a string. You can use this string as you want. You can print it manually or you can save it in a file. It is used to debug applications business logic.\n\n## Highlight class\n\n`rong.Highlight` is a class for highlighing text color. It is a inline usable class. You can use this class to highlight text in a single line. It has the following methods to highlight text.\n\n- To get white color `white(text:str)`\n\n- To get bold white color `bwhite(text:str)`\n\n- To get green color `green(text:str)`\n\n- To get bold green color `bgreen(text:str)`\n\n- To get blue color `blue(text:str)`\n\n- To get bold blue color `bblue(text:str)`\n\n- To get yellow color `yellow(text:str)`\n\n- To get bold yellow color `byellow(text:str)`\n\n- To get red color `red(text:str)`\n\n- To get bold red color `bred(text:str)`\n\n### Highlight Example\n\n```python\nfrom rong import Highlight\n\nprint(Highlight.red(\"This is a red text\"))\nprint(Highlight.bred(\"This is a bold red text\"))\nprint(Highlight.blue(\"This is a blue text\"))\nprint(Highlight.bblue(\"This is a bold blue text\"))\nprint(Highlight.yellow(\"This is a yellow text\"))\n\nprint(f\"This is a {Highlight.green('green')} text\")\nprint(f\"This is a {Highlight.bgreen('bold green')} text\")\n```\n\n## Text class\n\nMost powerfull class in this module is `rong.Text`. It is used to create a text object with different styles and colors. It has the following methods to create a text object.\n\n- `foreground(color: ForegroundColor) -> Text`\n\n- `background(color: BackgroundColor) -> Text`\n\n- `style(styles: List[Style]) -> str`\n\n- `update(text: str) -> Text`\n\n- `print() -> None`\n\nYou can dynamically add colors and styles to the text object with this methods. It is also possible to update the text of the object. You can print the output with `print` method. Normal `print(text)` also works same as `text.print()`.\n\n### Text Example\n\n```python\nimport rong\n\nlog = rong.Log(debug=False)\n\ntext = rong.Text(\n    log.errormsg(\"Something went wrong! Please try again.\"),\n    fg=rong.ForegroundColor.VIOLET,\n    bg=rong.BackgroundColor.TRANSPARENT,\n    styles=[rong.Style.BOLD, rong.Style.UNDERLINE_WAVY, rong.Style.BLINK],\n)\n\ntext.print()\n```\n\nHere, in this example we have created a text object with a error message and added some styles and colors. Then we have printed the output.\n\n## Random methods\n\n`rong` module has some random methods to get `ForegroundColor`, `BackgroundColor` and `Style` to make it more easy to use. Here is the example to use this module.\n\n### Random Example\n\n```python\nfrom rong import (\n\tget_random_background_color,\n\tget_random_foreground_color,\n\tget_random_style,\n)\n\nprint(get_random_background_color())\nprint(get_random_foreground_color())\nprint(get_random_style())\n```\n\nYou can use this methods with `Text` class to get random colors and styles.\n\n```python\nfrom rong import (\n\tget_random_background_color,\n\tget_random_foreground_color,\n\tget_random_style,\n\tText,\n)\n\ntext = Text(\n\t\"Hello World!\",\n\tfg=get_random_foreground_color(),\n\tbg=get_random_background_color(),\n\tstyles=[get_random_style()],\n)\n\nprint(text)\n```\n\n## All Examples\n\nHere is the all examples to use this module.\n\n```python\nfrom rong import *\n\n# In line Log display\nlog = Log(debug=False)\nprint(f\"This is a {log.primary('sample')} test.\")\nprint(f\"This is a {log.waitmsg('sample')} test.\")\nprint(f\"This is a {log.errormsg('sample')} test.\")\nprint(f\"This is a {log.warning('sample')} test.\")\n\n# Normal log\nlog = Log()  # debug=True by default\nlog.waitmsg('Please wait...')\nlog.errormsg('Something went wrong! Please try again.')\nlog.warning('This is a warning message.')\nlog.primary('This is a primary message.')\n\n\n# In line text highlighting\nprint(f\"This is a {Highlight.red('sample')} test.\")\nprint(f\"This is a {Highlight.bred('sample')} test.\")\nprint(f\"This is a {Highlight.blue('sample')} test.\")\nprint(f\"This is a {Highlight.bblue('sample')} test.\")\nprint(f\"This is a {Highlight.yellow('sample')} test.\")\nprint(f\"This is a {Highlight.byellow('sample')} test.\")\n\n\n# Working with Text objects\n# Creating Text class object\ntext = Text(text='Sample Text')\n\n# Adding forground color / text color\ntext.foreground(ForegroundColor.BLUE)\ntext.foreground(ForegroundColor.PURPLE)\n\n# Adding background color\ntext.background(BackgroundColor.WHITE)\n\n# Adding custom styles\ntext.style(styles=[Style.BOLD, Style.UNDERLINE])\n\n# Updating object text\ntext.update(text=' New text ')\n\n# Printing output in two ways\n# Advance methode bashed mode\ntext.print()\n# Normal pythonic mode\nprint(text)\n\n# Doing everything in one line\ntext1 = Text(\n    text='Demo1',\n    fg=ForegroundColor.BLUE,\n    bg=BackgroundColor.WHITE,\n    styles=[Style.BOLD],\n)\ntext1.print()\n\n# Clearing all styles\ntext2 = Text(text='Demo', styles=[Style.CLEAR])\ntext2.print()\n\n\n# Random methods. This return random Enum class object of ForegroundColor, BackgroundColor and Style.\nprint(get_random_background_color())\nprint(get_random_foreground_color())\nprint(get_random_style())\n\ntext3 = Text(\n\t\"Hello World!\",\n\tfg=get_random_foreground_color(),\n\tbg=get_random_background_color(),\n\tstyles=[get_random_style()],\n)\n\nprint(text3)\n```\n\n### Output Screenshot\n\n![Screenshot](https://raw.githubusercontent.com/Almas-Ali/rong/master/screenshot-1.png \"Output Screenshot\")\n\n## Change History\n\n**0.0.3** - Updated color and style with `Enum` class. Added `unittest` for more reliability. Refactored hole code base.\n\n**0.0.2** - Fixed default background issue, added huge amonut of colors and styles varient. Added more examples and documentation.\n\n**0.0.1** - Initialized this project and written all this codes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\n> [!IMPORTANT]\n> Everything is open source. You can contribute in this project by submitting a issue or fixing a problem and make pull request.\n\nMade with love by \u00a9 [**_Md. Almas Ali_**][1]\n\n[1]: https://github.com/Almas-Ali \"Md. Almas Ali\"\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022-present Md. Almas Ali  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A coloring utility for Python console apps.",
    "version": "0.0.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/Almas-Ali/rong/issues",
        "Documentation": "https://github.com/Almas-Ali/rong#readme",
        "Homepage": "https://github.com/Almas-Ali/rong",
        "Repository": "https://github.com/Almas-Ali/rong"
    },
    "split_keywords": [
        "background",
        "color",
        "colored",
        "coloring",
        "colour",
        "console",
        "foreground",
        "formatting",
        "rgb",
        "rong",
        "style",
        "terminal",
        "text",
        "utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8bdc04c14bb0f1fc2e798b7efa90616816614329a8dc8f6dfabdf06395c11c89",
                "md5": "047855f45c8ef072635436fba44fa871",
                "sha256": "064c55dfdc22c3401462d0cd3e5ef98f00663f7dca64f529581201ae9fcfda8a"
            },
            "downloads": -1,
            "filename": "rong-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "047855f45c8ef072635436fba44fa871",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9113,
            "upload_time": "2024-03-11T18:53:47",
            "upload_time_iso_8601": "2024-03-11T18:53:47.515445Z",
            "url": "https://files.pythonhosted.org/packages/8b/dc/04c14bb0f1fc2e798b7efa90616816614329a8dc8f6dfabdf06395c11c89/rong-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a7452fbd76dbd050c5a381bea9af09730a1c8c600446e89dafb9789905ceaa6",
                "md5": "7cfd15f27c0494649811db0bdfcead15",
                "sha256": "2f717505d6f374b086a7325d08f7ef6aef531c73e2d2b35cc46f9c34006a4119"
            },
            "downloads": -1,
            "filename": "rong-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7cfd15f27c0494649811db0bdfcead15",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 277968,
            "upload_time": "2024-03-11T18:53:48",
            "upload_time_iso_8601": "2024-03-11T18:53:48.775253Z",
            "url": "https://files.pythonhosted.org/packages/3a/74/52fbd76dbd050c5a381bea9af09730a1c8c600446e89dafb9789905ceaa6/rong-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 18:53:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Almas-Ali",
    "github_project": "rong",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rong"
}
        
Elapsed time: 0.68718s