Colored Matrix
A Python library for changing the colors in the terminal using ANSI escape codes.
Installation
To install Colored Matrix, use pip:
pip install coloredmatrix
Usage
To use Colored Matrix, import the Stylize class and the Color constants, and call the desired methods on a Stylize object:
from coloredmatrix import Stylize, Color
# Set the background color to green
print(Stylize("hello").bg_color(Color.Green))
# Set the background color to red
print(Stylize("hello").bg_color(Color.Red))
# Set the background color to green and the foreground color to red
print(Stylize("hello").bg_color(Color.Green).fg_color(Color.Red))
# Set the text to bold and underlined
print(Stylize("hello").bold().underline())
You can also pass an RGB color tuple to the bg_color and fg_color methods:
from coloredmatrix import Stylize
# Set the background color to red using an RGB color tuple
print(Stylize("hello").bg_color((255, 0, 0)))
# Set the background color to green using an RGB color tuple
print(Stylize("hello").bg_color((0, 255, 0)))
# Set the background color to red and the foreground color to green using RGB color tuples
print(Stylize("hello").bg_color((255, 0, 0)).fg_color((0, 255, 0)))
Text Styling
The Stylize class provides the following methods for styling text:
bold: Makes the text bolditalic: Makes the text italicunderline: Underlines the textblink: Makes the text blinkstrike: Strikes through the text
You can chain these methods to apply multiple styles to the same text. For example:
from coloredmatrix import Stylize
# Set the text to bold, italic, and underlined
print(Stylize("hello").bold().italic().underline())
# Set the text to blink and struck through
print(Stylize("hello").blink().strike())
Supported Colors
You can also use RGB color tuples to specify any other color.
The Color constants define the following colors:
| Color Name | Color Name | Color Name | Color Name | Color Name |
|---|---|---|---|---|
| MediumVioletRed | DeepPink | PaleVioletRed | HotPink | LightPink |
| Pink | DarkRed | Red | Firebrick | Crimson |
| IndianRed | LightCoral | Salmon | DarkSalmon | LightSalmon |
| OrangeRed | Tomato | DarkOrange | Coral | Orange |
| DarkKhaki | Gold | Khaki | PeachPuff | Yellow |
| PaleGoldenrod | Moccasin | PapayaWhip | LightGoldenrodYellow | LemonChiffon |
| LightYellow | Maroon | Brown | SaddleBrown | Sienna |
| Chocolate | DarkGoldenrod | Peru | RosyBrown | Goldenrod |
| SandyBrown | Tan | Burlywood | Wheat | NavajoWhite |
| Bisque | BlanchedAlmond | Cornsilk | Indigo | Purple |
| DarkMagenta | DarkViolet | DarkSlateBlue | BlueViolet | DarkOrchid |
| Fuchsia | Magenta | SlateBlue | MediumSlateBlue | MediumOrchid |
| MediumPurple | Orchid | Violet | Plum | Thistle |
| Lavender | MidnightBlue | Navy | DarkBlue | MediumBlue |
| Blue | RoyalBlue | SteelBlue | DodgerBlue | DeepSkyBlue |
| CornflowerBlue | SkyBlue | LightSkyBlue | LightSteelBlue | LightBlue |
| PowderBlue | Teal | DarkCyan | LightSeaGreen | CadetBlue |
| DarkTurquoise | MediumTurquoise | Turquoise | Aqua | Cyan |
| Aquamarine | PaleTurquoise | LightCyan | DarkGreen | Green |
| DarkOliveGreen | ForestGreen | SeaGreen | Olive | OliveDrab |
| MediumSeaGreen | LimeGreen | Lime | SpringGreen | MediumSpringGreen |
| DarkSeaGreen | MediumAquamarine | YellowGreen | LawnGreen | Chartreuse |
| LightGreen | GreenYellow | PaleGreen | MistyRose | AntiqueWhite |
| Linen | Beige | WhiteSmoke | LavenderBlush | OldLace |
| AliceBlue | Seashell | GhostWhite | Honeydew | FloralWhite |
| Azure | MintCream | Snow | Ivory | White |
| Black | DarkSlateGray | DimGray | SlateGray | Gray |
| LightSlateGray | DarkGray | Silver | LightGray | Gainsboro |
License
License Colored Matrix is released under the MIT License. See the LICENSE file for more information.
Metadata
Release files for coloredmatrix 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coloredmatrix-0.0.2.tar.gz | 5.8 kB | Without provenance | Details for coloredmatrix-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coloredmatrix-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for coloredmatrix-0.0.2-py3-none-any.whl |
Total release size: 11.5 kB
Release files / coloredmatrix-0.0.2.tar.gz
| Download URL | coloredmatrix-0.0.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2a6007698fe0e0bb0b72fcf09ffc4c92948f3c7a5eca70a83b96231b4ef04d5
|
|
BLAKE2b-256 checksum How to use checksums |
1fdd598b27924defe26f32afe5e796e9980753873102e53af39b6fcb00d6b319
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / coloredmatrix-0.0.2-py3-none-any.whl
| Download URL | coloredmatrix-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f4f4a422c0143895888f68d124223f684a2ef3e81e030f1ddb29183a108d42d
|
|
BLAKE2b-256 checksum How to use checksums |
46a7ccec18dfc44146d4b3f95013e0cc27237384ee3838d44b303618d1496cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for coloredmatrix 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.