| 1 | <a href="https://dslackw.gitlab.io/colored"> |
| 2 | <img src="https://gitlab.com/dslackw/colored/-/raw/site/docs/images/colored.png" title="colored"></a> |
| 3 | |
| 4 | ## About |
| 5 | |
| 6 | Colored, it's a simple Python library for color and formatting in terminal. |
| 7 | Collection of color codes and names for 256 color terminal setups. |
| 8 | Colored now supports RGB color mode. As "true color" graphic cards with 16 to <a href="https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit" target="_blank">24 bits</a> of color became common, |
| 9 | applications began to support 24-bit colors. Terminal emulators supporting setting 24-bit foreground and background |
| 10 | colors with escape sequences include Xterm, KDE's <a href="https://en.wikipedia.org/wiki/Konsole" target="_blank">Konsole</a>, and iTerm, as well as all libvte based terminals, |
| 11 | including <a href="https://en.wikipedia.org/wiki/GNOME_Terminal" target="_blank">GNOME Terminal</a>. |
| 12 | |
| 13 | The colors work with most terminals and terminals emulators. |
| 14 | <a href="https://en.wikipedia.org/wiki/ANSI_escape_code" target="_blank">ANSI/VT100 escape sequences</a> can be used in every programming languages. |
| 15 | |
| 16 | Colored is powerful and easy to use: |
| 17 | |
| 18 | ```python title="Python 3.9.17" |
| 19 | >>> from colored import Fore, Back, Style |
| 20 | >>> |
| 21 | >>> Fore.red |
| 22 | '\x1b[38;5;1m' |
| 23 | >>> |
| 24 | >>> Back.red |
| 25 | '\x1b[48;5;1m' |
| 26 | >>> |
| 27 | >>> Style.reset |
| 28 | '\x1b[0m' |
| 29 | >>> |
| 30 | >>> Fore.rgb('100%', '50%', '30%') |
| 31 | '\x1b[38;2;255;130;79m' |
| 32 | >>> |
| 33 | >>> print(f'{Fore.white}{Back.green}Colored is Awesome!!!{Style.reset}') |
| 34 | ``` |
| 35 | !!! success |
| 36 | <p> >>> <span style="background-color: green"> |
| 37 | <span style="color: white">Colored is Awesome!!!</span></span> |
| 38 | </p> |
| 39 | |
| 40 | ## Installing |
| 41 | |
| 42 | Open up a terminal and install colored with <a href="https://pip.pypa.io/en/stable/" target="_blank">pip</a> command: |
| 43 | |
| 44 | ```bash |
| 45 | $ pip install colored |
| 46 | ``` |
| 47 | |
| 48 | Alternatively, you can grab the latest source code from <a href="https://gitlab.com/dslackw/colored" target="_blank">GitLab</a>: |
| 49 | ```bash |
| 50 | $ git clone https://gitlab.com/dslackw/colored.git |
| 51 | $ cd colored |
| 52 | $ pip install . |
| 53 | ``` |
| 54 | |
| 55 | ## Usage |
| 56 | |
| 57 | The [User Guide](https://dslackw.gitlab.io/colored/user_guide/user_guide/#user-guide) is the place to go to learn how to use the library. |
| 58 | |
| 59 | The [API Reference](https://dslackw.gitlab.io/colored/api/attributes/) documentation provides API-level documentation. |
| 60 | |
| 61 | ## License |
| 62 | |
| 63 | colored is made available under the MIT License. For more details, see [here](https://dslackw.gitlab.io/colored/license/#mit-license). |
| 64 | |
| 65 | ## Contributing |
| 66 | |
| 67 | !!! info |
| 68 | We happily welcome [contributions](https://dslackw.gitlab.io/colored/contributors/)! |
| 69 | |
| 70 | ## Donate |
| 71 | |
| 72 | Did you know that we developers love coffee? |
| 73 | |
| 74 | [<img src="https://gitlab.com/dslackw/colored/-/raw/site/docs/images/paypaldonate.png" alt="paypal" title="donate">](https://www.paypal.me/dslackw) |