{"id":18077346,"url":"https://github.com/parisneo/ascii_colors","last_synced_at":"2025-04-05T20:13:00.425Z","repository":{"id":198791349,"uuid":"701560534","full_name":"ParisNeo/ascii_colors","owner":"ParisNeo","description":"A python library for displaying stuff on the console in a pretty way","archived":false,"fork":false,"pushed_at":"2024-01-27T21:07:18.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-29T18:23:15.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ParisNeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-06T23:16:02.000Z","updated_at":"2024-05-29T03:58:46.240Z","dependencies_parsed_at":null,"dependency_job_id":"d8f1a388-7106-4788-ac2c-9a23f7e1164e","html_url":"https://github.com/ParisNeo/ascii_colors","commit_stats":null,"previous_names":["parisneo/console_tools"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Fascii_colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Fascii_colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Fascii_colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParisNeo%2Fascii_colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ParisNeo","download_url":"https://codeload.github.com/ParisNeo/ascii_colors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393572,"owners_count":20931813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T11:24:16.834Z","updated_at":"2025-04-05T20:13:00.405Z","avatar_url":"https://github.com/ParisNeo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASCIIColors\n\nASCIIColors is a Python utility that provides an easy way to add color and style to text output in the console. It offers a simple interface for printing text with various colors and styles, making it especially useful for enhancing the readability of console-based applications or adding emphasis to specific messages. It also includes advanced logging capabilities with customizable templates, log levels, and file logging support.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Basic Usage](#basic-usage)\n- [Standard Methods](#standard-methods)\n- [Colors and Styles](#colors-and-styles)\n- [Advanced Logging](#advanced-logging)\n- [Development](#development)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\nYou can install ASCIIColors via `pip` from the Python Package Index (PyPI):\n\n```bash\npip install ascii_colors\n```\n\n## Basic Usage\n\nASCIIColors provides a set of methods for printing text with different colors and styles:\n\n```python\nfrom asciicolors import ASCIIColors\n\n# Print text in bright red color\nASCIIColors.print(\"Hello, world!\", ASCIIColors.color_bright_red)\n```\n\n## Standard Methods\n\nASCIIColors provides the following methods for formatting and printing text:\n\n- `print(text, color=color_bright_red, style=\"\", end=\"\\n\", flush=False)`: Prints text with the specified color and style.\n- `warning(text, end=\"\\n\", flush=False)`: Prints text in a warning style.\n- `error(text, end=\"\\n\", flush=False)`: Prints text in an error style.\n- `success(text, end=\"\\n\", flush=False)`: Prints text in a success style.\n- `info(text, end=\"\\n\", flush=False)`: Prints text in an info style.\n\nColor-specific methods:\n- `red(text, end=\"\\n\", flush=False)`\n- `green(text, end=\"\\n\", flush=False)`\n- `blue(text, end=\"\\n\", flush=False)`\n- `yellow(text, end=\"\\n\", flush=False)`\n- `magenta(text, end=\"\\n\", flush=False)`\n- `cyan(text, end=\"\\n\", flush=False)`\n\nStyle methods:\n- `bold(text, color=color_bright_red, end=\"\\n\", flush=False)`\n- `underline(text, color=color_bright_red, end=\"\\n\", flush=False)`\n\nControl methods:\n- `activate(color_or_style)`\n- `reset()`\n- `resetColor()`\n- `resetStyle()`\n- `resetAll()`\n\n## Colors and Styles\n\nAvailable colors:\n```python\n# Regular colors\ncolor_black\ncolor_red\ncolor_green\ncolor_yellow\ncolor_blue\ncolor_magenta\ncolor_cyan\ncolor_white\ncolor_orange\n\n# Bright colors\ncolor_bright_black\ncolor_bright_red\ncolor_bright_green\ncolor_bright_yellow\ncolor_bright_blue\ncolor_bright_magenta\ncolor_bright_cyan\ncolor_bright_white\ncolor_bright_orange\n\n# Styles\nstyle_bold\nstyle_underline\n```\n\n## Advanced Logging\n\n### Log Levels\n\nASCIIColors now supports four log levels:\n\n```python\nfrom ascii_colors import LogLevel\n\nLogLevel.DEBUG    # Detailed information for debugging\nLogLevel.INFO     # General information\nLogLevel.WARNING  # Warning messages\nLogLevel.ERROR    # Error messages\n\n# Set minimum log level\nASCIIColors.set_log_level(LogLevel.WARNING)  # Only show WARNING and ERROR messages\n```\n\n### Customizable Templates\n\nYou can customize the message format for each log level:\n\n```python\n# Custom template with datetime and additional fields\nASCIIColors.set_template(\n    LogLevel.INFO,\n    \"ℹ️ {datetime} | {message} | {custom_field}\"\n)\n\n# Using the template\nASCIIColors.info(\"Hello\", custom_field=\"test\")\n# Output: ℹ️ 2025-01-12 21:38:05 | Hello | test\n```\n\n### File Logging\n\nEnable logging to a file:\n\n```python\n# Set up file logging\nASCIIColors.set_log_file(\"logs/app.log\")\n\n# All subsequent messages will be written to both console and file\nASCIIColors.info(\"This message is logged to file\")\n```\n\n## Exception Tracing\n\nTrace and color your exceptions:\n\n```python\nfrom asciicolors import trace_exception\n\ntry:\n    # some code that might raise an exception\n    pass\nexcept Exception as ex:\n    trace_exception(ex)\n```\n\n## Multicolor Text\n\nPrint text with multiple colors:\n\n```python\nASCIIColors.multicolor(\n    [\"Green text\", \"red text\", \"yellow text\"],\n    [ASCIIColors.color_green, ASCIIColors.color_red, ASCIIColors.color_yellow]\n)\n```\n\n## Development\n\nTo set up the development environment:\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/ascii_colors.git\ncd ascii_colors\n\n# Install development dependencies\npip install -r requirements-dev.txt\n\n# Install pre-commit hooks\npre-commit install\n```\n\n### Running Tests\n\n```bash\npython -m pytest tests/\n```\n\n### Type Checking\n\n```bash\nmypy ascii_colors.py\n```\n\n## Contributing\n\nContributions to ASCIIColors are welcome! If you have ideas for improvements or new features, please feel free to open an issue or submit a pull request. Make sure to follow the contribution guidelines.\n\n## License\n\nASCIIColors is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.\n\n## Changelog\n\n### v0.5.0\n- Added log levels (DEBUG, INFO, WARNING, ERROR)\n- Added customizable message templates\n- Added file logging support\n- Added thread-safe operations\n- Added comprehensive type hints\n- Added unit tests\n- Added pre-commit configuration\n\n### v0.0.1\n- Initial release with basic color support\n- Basic print methods\n- Simple styling options","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Fascii_colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparisneo%2Fascii_colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparisneo%2Fascii_colors/lists"}