make-colors


Namemake-colors JSON
Version 3.39 PyPI version JSON
download
home_pagehttps://github.com/cumulus13/make_colors
SummaryA simple, powerful and cross-platform Python library for adding colors to your terminal output with cross-platform support, especially optimized for Windows 10+ terminals.
upload_time2025-09-09 18:20:21
maintainercumulus13
docs_urlNone
authorHadi Cahyadi LD
requires_python>=2.7
licenseMIT
keywords color terminal console ansi text colorize cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🎨 make_colors

A simple, powerful and cross-platform Python library for adding colors to your terminal output with cross-platform support, especially optimized for Windows 10+ terminals.

[![Python Version](https://img.shields.io/badge/python-2.7%2B%20%7C%203.x-blue.svg)](https://python.org)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

## 📋 Table of Contents

- [Features](#-features)
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [Color Reference](#-color-reference)
- [Usage Examples](#-usage-examples)
- [Environment Variables](#-environment-variables)
- [API Reference](#-api-reference)
- [Platform Support](#-platform-support)
- [Contributing](#-contributing)
- [License](#-license)

[![Example Usage](https://github.com/cumulus13/make_colors/raw/refs/heads/master/example_usage.gif)](https://github.com/cumulus13/make_colors/raw/refs/heads/master/example_usage.gif)


## ✨ Features

- 🖥️ **Cross-platform support** - Works on Windows, Linux, and macOS
- 🎯 **Windows 10+ optimized** - Special support for modern Windows terminals
- 🌈 **Rich color palette** - 16 colors with light variants
- 📝 **Simple syntax** - Easy-to-use color shortcuts and full names
- 🔧 **Flexible formatting** - Support for foreground/background combinations
- 🚀 **Lightweight** - Minimal dependencies, fast performance
- 🎛️ **Environment control** - Enable/disable colors via environment variables

## 📦 Installation

Install make_colors using pip:

```bash
pip install make_colors
```

## 🚀 Quick Start

```python
from make_colors import make_colors

# Simple colored text
print(make_colors("Hello World!", "red"))

# Text with background
print(make_colors("Important Message", "white", "red"))

# Using shortcuts
print(make_colors("Quick and easy", "r", "bl"))  # red text, blue background

# Using underscore notation
print(make_colors("One-liner style", "green_yellow"))  # green text, yellow background
```

## 🎨 Color Reference

### Available Colors

| Color Name | Shortcut | Light Variant | Light Shortcut |
|-----------|----------|---------------|----------------|
| black     | b, bk    | lightblack    | lb             |
| red       | r, rd, re| lightred      | lr             |
| green     | g, gr, ge| lightgreen    | lg             |
| yellow    | y, ye, yl| lightyellow   | ly             |
| blue      | bl       | lightblue     | lb             |
| magenta   | m, mg, ma| lightmagenta  | lm             |
| cyan      | c, cy, cn| lightcyan     | lc             |
| white     | w, wh, wi, wt | lightwhite | lw        |

### Color Preview

```python
# Standard colors
print(make_colors("■ Black text", "black"))
print(make_colors("■ Red text", "red"))
print(make_colors("■ Green text", "green"))
print(make_colors("■ Yellow text", "yellow"))
print(make_colors("■ Blue text", "blue"))
print(make_colors("■ Magenta text", "magenta"))
print(make_colors("■ Cyan text", "cyan"))
print(make_colors("■ White text", "white"))

# Light variants
print(make_colors("■ Light Red", "lightred"))
print(make_colors("■ Light Green", "lightgreen"))
print(make_colors("■ Light Blue", "lightblue"))
print(make_colors("■ Light Yellow", "lightyellow"))
```

## 💡 Usage Examples

### Basic Usage

```python
from make_colors import make_colors

# Different ways to specify colors
print(make_colors("Full color names", "red", "white"))
print(make_colors("Using shortcuts", "r", "w"))
print(make_colors("Mixed notation", "red", "w"))
```

### Separator Notation

```python
# Using underscore separator
print(make_colors("Error occurred!", "red_white"))
print(make_colors("Success!", "green_black"))
print(make_colors("Warning!", "yellow_red"))

# Using dash separator
print(make_colors("Info message", "blue-white"))
print(make_colors("Debug info", "cyan-black"))
```

### Advanced Examples

```python
# System status display
def show_status(service, status):
    if status == "running":
        return make_colors(f"[✓] {service}", "lightgreen", "black")
    elif status == "stopped":
        return make_colors(f"[✗] {service}", "lightred", "black")
    else:
        return make_colors(f"[?] {service}", "lightyellow", "black")

print(show_status("Web Server", "running"))
print(show_status("Database", "stopped"))
print(show_status("Cache", "unknown"))

# Log level formatting
def log_message(level, message):
    colors = {
        "ERROR": ("lightwhite", "red"),
        "WARNING": ("black", "yellow"),
        "INFO": ("lightblue", "black"),
        "DEBUG": ("lightgrey", "black")
    }
    
    fg, bg = colors.get(level, ("white", "black"))
    return f"{make_colors(f' {level} ', fg, bg)} {message}"

print(log_message("ERROR", "Connection failed"))
print(log_message("WARNING", "Deprecated method used"))
print(log_message("INFO", "Server started successfully"))
print(log_message("DEBUG", "Variable value: 42"))
```

### Progress Indicators

```python
import time

def progress_bar(current, total, width=50):
    percentage = current / total
    filled = int(width * percentage)
    bar = "█" * filled + "░" * (width - filled)
    
    if percentage < 0.5:
        color = "red"
    elif percentage < 0.8:
        color = "yellow"
    else:
        color = "green"
    
    return make_colors(f"[{bar}] {current}/{total} ({percentage:.1%})", color)

# Simulate progress
for i in range(0, 101, 10):
    print(f"\r{progress_bar(i, 100)}", end="", flush=True)
    time.sleep(0.1)
print()  # New line after completion
```

### Menu Systems

```python
def create_menu():
    options = [
        ("1", "Start Application", "green"),
        ("2", "Settings", "yellow"),
        ("3", "Help", "blue"),
        ("4", "Exit", "red")
    ]
    
    print(make_colors(" 🎯 Main Menu ", "white", "blue"))
    print()
    
    for key, option, color in options:
        print(f"  {make_colors(key, 'white', color)} {option}")
    
    print()
    return input("Select option: ")

# Usage
choice = create_menu()
```

## 🌍 Environment Variables

Control make_colors behavior with environment variables:

| Variable | Values | Description |
|----------|--------|-------------|
| `MAKE_COLORS` | `0`, `1` | Disable/enable colors globally |
| `MAKE_COLORS_FORCE` | `0`, `1`, `True` | Force colors even when not supported |

```python
import os

# Disable colors
os.environ['MAKE_COLORS'] = '0'
print(make_colors("No colors", "red"))  # Output: "No colors" (no coloring)

# Force colors (useful for CI/CD or redirected output)
os.environ['MAKE_COLORS_FORCE'] = '1'
print(make_colors("Forced colors", "green"))  # Always colored
```

## 📚 API Reference

### `make_colors(string, foreground='white', background=None, attrs=[], force=False)`

Colorizes a string with specified foreground and background colors.

**Parameters:**
- `string` (str): Text to colorize
- `foreground` (str): Foreground color name or shortcut
- `background` (str, optional): Background color name or shortcut
- `attrs` (list, optional): Text attributes (currently reserved for future use)
- `force` (bool, optional): Force coloring even when not supported

**Returns:**
- `str`: Colorized string with ANSI escape codes

**Examples:**
```python
# Basic usage
make_colors("Hello", "red")

# With background
make_colors("Hello", "white", "red")

# Using shortcuts
make_colors("Hello", "w", "r")

# Separator notation
make_colors("Hello", "white_red")

# Force colors
make_colors("Hello", "red", force=True)
```

### `MakeColors.supports_color()`

Class method to check if the current terminal supports color output.

**Returns:**
- `bool`: True if colors are supported, False otherwise

```python
from make_colors import MakeColors

if MakeColors.supports_color():
    print("Colors are supported!")
else:
    print("Colors not supported on this terminal")
```

## 🖥️ Platform Support

### Windows
- **Windows 10+**: Full support with native ANSI escape sequences
- **Older Windows**: Limited support, requires ANSICON or similar tools
- **Windows Terminal**: Excellent support with all features

### Linux/Unix
- **Most terminals**: Full support (xterm, gnome-terminal, konsole, etc.)
- **Tmux/Screen**: Supported
- **SSH sessions**: Supported when terminal supports colors

### macOS
- **Terminal.app**: Full support
- **iTerm2**: Excellent support
- **Other terminals**: Generally well supported

## 🛠️ Development Examples

### Testing Colors

```python
def test_all_colors():
    """Test all available colors"""
    colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
    light_colors = [f'light{color}' for color in colors if color != 'black'] + ['lightgrey']
    
    print("=== Standard Colors ===")
    for color in colors:
        print(make_colors(f"  {color.ljust(10)}", color, "black"))
    
    print("\n=== Light Colors ===")
    for color in light_colors:
        print(make_colors(f"  {color.ljust(15)}", color, "black"))

# Run the test
test_all_colors()
```

### Color Compatibility Check

```python
def check_color_support():
    """Check and display color support information"""
    from make_colors import MakeColors
    import sys
    import os
    
    print("=== Color Support Information ===")
    print(f"Platform: {sys.platform}")
    print(f"Colors supported: {MakeColors.supports_color()}")
    print(f"MAKE_COLORS env: {os.getenv('MAKE_COLORS', 'not set')}")
    print(f"MAKE_COLORS_FORCE env: {os.getenv('MAKE_COLORS_FORCE', 'not set')}")
    
    if hasattr(sys.stdout, 'isatty'):
        print(f"Is TTY: {sys.stdout.isatty()}")

check_color_support()
```

## 🎯 Best Practices

1. **Check color support** before using in production applications
2. **Provide fallbacks** for environments without color support  
3. **Use environment variables** to control color output
4. **Choose contrasting colors** for better readability
5. **Test on multiple platforms** to ensure compatibility

```python
from make_colors import make_colors, MakeColors

def safe_print(text, fg="white", bg=None):
    """Safely print colored text with fallback"""
    if MakeColors.supports_color():
        print(make_colors(text, fg, bg))
    else:
        print(f"[{fg.upper()}] {text}")

# Usage
safe_print("This works everywhere!", "green")
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## 📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

## Author

[Hadi Cahyadi](mailto:cumulus13@gmail.com)
    
[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)

[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)

[Support me on Patreon](https://www.patreon.com/cumulus13)

---

Made with ❤️ by Hadi Cahyadi for colorful terminal experiences!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cumulus13/make_colors",
    "name": "make-colors",
    "maintainer": "cumulus13",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "cumulus13@gmail.com",
    "keywords": "color, terminal, console, ansi, text, colorize, cli",
    "author": "Hadi Cahyadi LD",
    "author_email": "cumulus13@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/07/8d/1932750346df4d88de5b76bfbdfdbf23ef19aceda4c2d561ee131e2b8eaa/make_colors-3.39.tar.gz",
    "platform": null,
    "description": "# \ud83c\udfa8 make_colors\r\n\r\nA simple, powerful and cross-platform Python library for adding colors to your terminal output with cross-platform support, especially optimized for Windows 10+ terminals.\r\n\r\n[![Python Version](https://img.shields.io/badge/python-2.7%2B%20%7C%203.x-blue.svg)](https://python.org)\r\n[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com)\r\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\r\n\r\n## \ud83d\udccb Table of Contents\r\n\r\n- [Features](#-features)\r\n- [Installation](#-installation)\r\n- [Quick Start](#-quick-start)\r\n- [Color Reference](#-color-reference)\r\n- [Usage Examples](#-usage-examples)\r\n- [Environment Variables](#-environment-variables)\r\n- [API Reference](#-api-reference)\r\n- [Platform Support](#-platform-support)\r\n- [Contributing](#-contributing)\r\n- [License](#-license)\r\n\r\n[![Example Usage](https://github.com/cumulus13/make_colors/raw/refs/heads/master/example_usage.gif)](https://github.com/cumulus13/make_colors/raw/refs/heads/master/example_usage.gif)\r\n\r\n\r\n## \u2728 Features\r\n\r\n- \ud83d\udda5\ufe0f **Cross-platform support** - Works on Windows, Linux, and macOS\r\n- \ud83c\udfaf **Windows 10+ optimized** - Special support for modern Windows terminals\r\n- \ud83c\udf08 **Rich color palette** - 16 colors with light variants\r\n- \ud83d\udcdd **Simple syntax** - Easy-to-use color shortcuts and full names\r\n- \ud83d\udd27 **Flexible formatting** - Support for foreground/background combinations\r\n- \ud83d\ude80 **Lightweight** - Minimal dependencies, fast performance\r\n- \ud83c\udf9b\ufe0f **Environment control** - Enable/disable colors via environment variables\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nInstall make_colors using pip:\r\n\r\n```bash\r\npip install make_colors\r\n```\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n```python\r\nfrom make_colors import make_colors\r\n\r\n# Simple colored text\r\nprint(make_colors(\"Hello World!\", \"red\"))\r\n\r\n# Text with background\r\nprint(make_colors(\"Important Message\", \"white\", \"red\"))\r\n\r\n# Using shortcuts\r\nprint(make_colors(\"Quick and easy\", \"r\", \"bl\"))  # red text, blue background\r\n\r\n# Using underscore notation\r\nprint(make_colors(\"One-liner style\", \"green_yellow\"))  # green text, yellow background\r\n```\r\n\r\n## \ud83c\udfa8 Color Reference\r\n\r\n### Available Colors\r\n\r\n| Color Name | Shortcut | Light Variant | Light Shortcut |\r\n|-----------|----------|---------------|----------------|\r\n| black     | b, bk    | lightblack    | lb             |\r\n| red       | r, rd, re| lightred      | lr             |\r\n| green     | g, gr, ge| lightgreen    | lg             |\r\n| yellow    | y, ye, yl| lightyellow   | ly             |\r\n| blue      | bl       | lightblue     | lb             |\r\n| magenta   | m, mg, ma| lightmagenta  | lm             |\r\n| cyan      | c, cy, cn| lightcyan     | lc             |\r\n| white     | w, wh, wi, wt | lightwhite | lw        |\r\n\r\n### Color Preview\r\n\r\n```python\r\n# Standard colors\r\nprint(make_colors(\"\u25a0 Black text\", \"black\"))\r\nprint(make_colors(\"\u25a0 Red text\", \"red\"))\r\nprint(make_colors(\"\u25a0 Green text\", \"green\"))\r\nprint(make_colors(\"\u25a0 Yellow text\", \"yellow\"))\r\nprint(make_colors(\"\u25a0 Blue text\", \"blue\"))\r\nprint(make_colors(\"\u25a0 Magenta text\", \"magenta\"))\r\nprint(make_colors(\"\u25a0 Cyan text\", \"cyan\"))\r\nprint(make_colors(\"\u25a0 White text\", \"white\"))\r\n\r\n# Light variants\r\nprint(make_colors(\"\u25a0 Light Red\", \"lightred\"))\r\nprint(make_colors(\"\u25a0 Light Green\", \"lightgreen\"))\r\nprint(make_colors(\"\u25a0 Light Blue\", \"lightblue\"))\r\nprint(make_colors(\"\u25a0 Light Yellow\", \"lightyellow\"))\r\n```\r\n\r\n## \ud83d\udca1 Usage Examples\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom make_colors import make_colors\r\n\r\n# Different ways to specify colors\r\nprint(make_colors(\"Full color names\", \"red\", \"white\"))\r\nprint(make_colors(\"Using shortcuts\", \"r\", \"w\"))\r\nprint(make_colors(\"Mixed notation\", \"red\", \"w\"))\r\n```\r\n\r\n### Separator Notation\r\n\r\n```python\r\n# Using underscore separator\r\nprint(make_colors(\"Error occurred!\", \"red_white\"))\r\nprint(make_colors(\"Success!\", \"green_black\"))\r\nprint(make_colors(\"Warning!\", \"yellow_red\"))\r\n\r\n# Using dash separator\r\nprint(make_colors(\"Info message\", \"blue-white\"))\r\nprint(make_colors(\"Debug info\", \"cyan-black\"))\r\n```\r\n\r\n### Advanced Examples\r\n\r\n```python\r\n# System status display\r\ndef show_status(service, status):\r\n    if status == \"running\":\r\n        return make_colors(f\"[\u2713] {service}\", \"lightgreen\", \"black\")\r\n    elif status == \"stopped\":\r\n        return make_colors(f\"[\u2717] {service}\", \"lightred\", \"black\")\r\n    else:\r\n        return make_colors(f\"[?] {service}\", \"lightyellow\", \"black\")\r\n\r\nprint(show_status(\"Web Server\", \"running\"))\r\nprint(show_status(\"Database\", \"stopped\"))\r\nprint(show_status(\"Cache\", \"unknown\"))\r\n\r\n# Log level formatting\r\ndef log_message(level, message):\r\n    colors = {\r\n        \"ERROR\": (\"lightwhite\", \"red\"),\r\n        \"WARNING\": (\"black\", \"yellow\"),\r\n        \"INFO\": (\"lightblue\", \"black\"),\r\n        \"DEBUG\": (\"lightgrey\", \"black\")\r\n    }\r\n    \r\n    fg, bg = colors.get(level, (\"white\", \"black\"))\r\n    return f\"{make_colors(f' {level} ', fg, bg)} {message}\"\r\n\r\nprint(log_message(\"ERROR\", \"Connection failed\"))\r\nprint(log_message(\"WARNING\", \"Deprecated method used\"))\r\nprint(log_message(\"INFO\", \"Server started successfully\"))\r\nprint(log_message(\"DEBUG\", \"Variable value: 42\"))\r\n```\r\n\r\n### Progress Indicators\r\n\r\n```python\r\nimport time\r\n\r\ndef progress_bar(current, total, width=50):\r\n    percentage = current / total\r\n    filled = int(width * percentage)\r\n    bar = \"\u2588\" * filled + \"\u2591\" * (width - filled)\r\n    \r\n    if percentage < 0.5:\r\n        color = \"red\"\r\n    elif percentage < 0.8:\r\n        color = \"yellow\"\r\n    else:\r\n        color = \"green\"\r\n    \r\n    return make_colors(f\"[{bar}] {current}/{total} ({percentage:.1%})\", color)\r\n\r\n# Simulate progress\r\nfor i in range(0, 101, 10):\r\n    print(f\"\\r{progress_bar(i, 100)}\", end=\"\", flush=True)\r\n    time.sleep(0.1)\r\nprint()  # New line after completion\r\n```\r\n\r\n### Menu Systems\r\n\r\n```python\r\ndef create_menu():\r\n    options = [\r\n        (\"1\", \"Start Application\", \"green\"),\r\n        (\"2\", \"Settings\", \"yellow\"),\r\n        (\"3\", \"Help\", \"blue\"),\r\n        (\"4\", \"Exit\", \"red\")\r\n    ]\r\n    \r\n    print(make_colors(\" \ud83c\udfaf Main Menu \", \"white\", \"blue\"))\r\n    print()\r\n    \r\n    for key, option, color in options:\r\n        print(f\"  {make_colors(key, 'white', color)} {option}\")\r\n    \r\n    print()\r\n    return input(\"Select option: \")\r\n\r\n# Usage\r\nchoice = create_menu()\r\n```\r\n\r\n## \ud83c\udf0d Environment Variables\r\n\r\nControl make_colors behavior with environment variables:\r\n\r\n| Variable | Values | Description |\r\n|----------|--------|-------------|\r\n| `MAKE_COLORS` | `0`, `1` | Disable/enable colors globally |\r\n| `MAKE_COLORS_FORCE` | `0`, `1`, `True` | Force colors even when not supported |\r\n\r\n```python\r\nimport os\r\n\r\n# Disable colors\r\nos.environ['MAKE_COLORS'] = '0'\r\nprint(make_colors(\"No colors\", \"red\"))  # Output: \"No colors\" (no coloring)\r\n\r\n# Force colors (useful for CI/CD or redirected output)\r\nos.environ['MAKE_COLORS_FORCE'] = '1'\r\nprint(make_colors(\"Forced colors\", \"green\"))  # Always colored\r\n```\r\n\r\n## \ud83d\udcda API Reference\r\n\r\n### `make_colors(string, foreground='white', background=None, attrs=[], force=False)`\r\n\r\nColorizes a string with specified foreground and background colors.\r\n\r\n**Parameters:**\r\n- `string` (str): Text to colorize\r\n- `foreground` (str): Foreground color name or shortcut\r\n- `background` (str, optional): Background color name or shortcut\r\n- `attrs` (list, optional): Text attributes (currently reserved for future use)\r\n- `force` (bool, optional): Force coloring even when not supported\r\n\r\n**Returns:**\r\n- `str`: Colorized string with ANSI escape codes\r\n\r\n**Examples:**\r\n```python\r\n# Basic usage\r\nmake_colors(\"Hello\", \"red\")\r\n\r\n# With background\r\nmake_colors(\"Hello\", \"white\", \"red\")\r\n\r\n# Using shortcuts\r\nmake_colors(\"Hello\", \"w\", \"r\")\r\n\r\n# Separator notation\r\nmake_colors(\"Hello\", \"white_red\")\r\n\r\n# Force colors\r\nmake_colors(\"Hello\", \"red\", force=True)\r\n```\r\n\r\n### `MakeColors.supports_color()`\r\n\r\nClass method to check if the current terminal supports color output.\r\n\r\n**Returns:**\r\n- `bool`: True if colors are supported, False otherwise\r\n\r\n```python\r\nfrom make_colors import MakeColors\r\n\r\nif MakeColors.supports_color():\r\n    print(\"Colors are supported!\")\r\nelse:\r\n    print(\"Colors not supported on this terminal\")\r\n```\r\n\r\n## \ud83d\udda5\ufe0f Platform Support\r\n\r\n### Windows\r\n- **Windows 10+**: Full support with native ANSI escape sequences\r\n- **Older Windows**: Limited support, requires ANSICON or similar tools\r\n- **Windows Terminal**: Excellent support with all features\r\n\r\n### Linux/Unix\r\n- **Most terminals**: Full support (xterm, gnome-terminal, konsole, etc.)\r\n- **Tmux/Screen**: Supported\r\n- **SSH sessions**: Supported when terminal supports colors\r\n\r\n### macOS\r\n- **Terminal.app**: Full support\r\n- **iTerm2**: Excellent support\r\n- **Other terminals**: Generally well supported\r\n\r\n## \ud83d\udee0\ufe0f Development Examples\r\n\r\n### Testing Colors\r\n\r\n```python\r\ndef test_all_colors():\r\n    \"\"\"Test all available colors\"\"\"\r\n    colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']\r\n    light_colors = [f'light{color}' for color in colors if color != 'black'] + ['lightgrey']\r\n    \r\n    print(\"=== Standard Colors ===\")\r\n    for color in colors:\r\n        print(make_colors(f\"  {color.ljust(10)}\", color, \"black\"))\r\n    \r\n    print(\"\\n=== Light Colors ===\")\r\n    for color in light_colors:\r\n        print(make_colors(f\"  {color.ljust(15)}\", color, \"black\"))\r\n\r\n# Run the test\r\ntest_all_colors()\r\n```\r\n\r\n### Color Compatibility Check\r\n\r\n```python\r\ndef check_color_support():\r\n    \"\"\"Check and display color support information\"\"\"\r\n    from make_colors import MakeColors\r\n    import sys\r\n    import os\r\n    \r\n    print(\"=== Color Support Information ===\")\r\n    print(f\"Platform: {sys.platform}\")\r\n    print(f\"Colors supported: {MakeColors.supports_color()}\")\r\n    print(f\"MAKE_COLORS env: {os.getenv('MAKE_COLORS', 'not set')}\")\r\n    print(f\"MAKE_COLORS_FORCE env: {os.getenv('MAKE_COLORS_FORCE', 'not set')}\")\r\n    \r\n    if hasattr(sys.stdout, 'isatty'):\r\n        print(f\"Is TTY: {sys.stdout.isatty()}\")\r\n\r\ncheck_color_support()\r\n```\r\n\r\n## \ud83c\udfaf Best Practices\r\n\r\n1. **Check color support** before using in production applications\r\n2. **Provide fallbacks** for environments without color support  \r\n3. **Use environment variables** to control color output\r\n4. **Choose contrasting colors** for better readability\r\n5. **Test on multiple platforms** to ensure compatibility\r\n\r\n```python\r\nfrom make_colors import make_colors, MakeColors\r\n\r\ndef safe_print(text, fg=\"white\", bg=None):\r\n    \"\"\"Safely print colored text with fallback\"\"\"\r\n    if MakeColors.supports_color():\r\n        print(make_colors(text, fg, bg))\r\n    else:\r\n        print(f\"[{fg.upper()}] {text}\")\r\n\r\n# Usage\r\nsafe_print(\"This works everywhere!\", \"green\")\r\n```\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n## Author\r\n\r\n[Hadi Cahyadi](mailto:cumulus13@gmail.com)\r\n    \r\n[![Buy Me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/cumulus13)\r\n\r\n[![Donate via Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cumulus13)\r\n\r\n[Support me on Patreon](https://www.patreon.com/cumulus13)\r\n\r\n---\r\n\r\nMade with \u2764\ufe0f by Hadi Cahyadi for colorful terminal experiences!\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple, powerful and cross-platform Python library for adding colors to your terminal output with cross-platform support, especially optimized for Windows 10+ terminals.",
    "version": "3.39",
    "project_urls": {
        "Code": "https://github.com/cumulus13/make_colors",
        "Documentation": "https://github.com/cumulus13/make_colors",
        "Homepage": "https://github.com/cumulus13/make_colors",
        "Issue tracker": "https://github.com/cumulus13/make_colors/issues"
    },
    "split_keywords": [
        "color",
        " terminal",
        " console",
        " ansi",
        " text",
        " colorize",
        " cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "967bb4057d083d6330b8ac8d526caa0d5c8faef0e204aa9b3fd703fdd40e9957",
                "md5": "666fd8076a079124c48e257b5471f287",
                "sha256": "d399057b26d95c7c16fdf0527a6827a0422e9693d6d6b3987d259796f8d8862c"
            },
            "downloads": -1,
            "filename": "make_colors-3.39-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "666fd8076a079124c48e257b5471f287",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=2.7",
            "size": 16222,
            "upload_time": "2025-09-09T18:20:19",
            "upload_time_iso_8601": "2025-09-09T18:20:19.717971Z",
            "url": "https://files.pythonhosted.org/packages/96/7b/b4057d083d6330b8ac8d526caa0d5c8faef0e204aa9b3fd703fdd40e9957/make_colors-3.39-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "078d1932750346df4d88de5b76bfbdfdbf23ef19aceda4c2d561ee131e2b8eaa",
                "md5": "6c566ebbe2abc2a6a908871cc02e6775",
                "sha256": "b4c7ef419306bf992e8c81eb21db922fc90b727e4c370b202fe8ee094298b16a"
            },
            "downloads": -1,
            "filename": "make_colors-3.39.tar.gz",
            "has_sig": false,
            "md5_digest": "6c566ebbe2abc2a6a908871cc02e6775",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 19536,
            "upload_time": "2025-09-09T18:20:21",
            "upload_time_iso_8601": "2025-09-09T18:20:21.806929Z",
            "url": "https://files.pythonhosted.org/packages/07/8d/1932750346df4d88de5b76bfbdfdbf23ef19aceda4c2d561ee131e2b8eaa/make_colors-3.39.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-09 18:20:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cumulus13",
    "github_project": "make_colors",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "make-colors"
}
        
Elapsed time: 2.44908s