# Italica
A simple and elegant Python library for adding markdown-style formatting to print and input functions. Make your terminal output beautiful with bold, italic, colors, and more!
[](https://badge.fury.io/py/italica)
[](https://pypi.org/project/italica/)
[](https://opensource.org/licenses/MIT)
## Features
- 🎨 **Markdown-style formatting** - Use familiar syntax like `**bold**`, `*italic*`, `~~strikethrough~~`
- 🌈 **Rich color support** - 16 colors including bright variants
- 🖥️ **Cross-platform** - Works on Windows, macOS, and Linux
- ⚡ **Zero dependencies** - Uses only Python standard library
- 🔧 **Easy to use** - Drop-in replacement for `print()` and `input()`
- 🎯 **Auto-detection** - Automatically detects terminal color support
## Installation
```bash
pip install italica
```
## Quick Start
```python
from italica import print_fmt, input_fmt
# Print formatted text
print_fmt("Hello **world**!") # Bold text
print_fmt("This is *italic*") # Italic text
print_fmt("[red]Error message[/red]") # Red text
# Get input with formatted prompt
name = input_fmt("Enter your **name**: ")
age = input_fmt("[green]How old are you?[/green] ")
```
## Usage
### Basic Formatting
```python
from italica import print_fmt
# Bold text
print_fmt("This is **bold** text")
# Italic text
print_fmt("This is *italic* text")
# Strikethrough
print_fmt("This is ~~crossed out~~ text")
# Code/monospace
print_fmt("This is `code` text")
# Combined formatting
print_fmt("This is **bold** and *italic* and ~~strikethrough~~")
```
### Colors
```python
from italica import print_fmt
# Basic colors
print_fmt("[red]Red text[/red]")
print_fmt("[green]Green text[/green]")
print_fmt("[blue]Blue text[/blue]")
print_fmt("[yellow]Yellow text[/yellow]")
print_fmt("[magenta]Magenta text[/magenta]")
print_fmt("[cyan]Cyan text[/cyan]")
# Bright colors
print_fmt("[bright_red]Bright red text[/bright_red]")
print_fmt("[bright_green]Bright green text[/bright_green]")
print_fmt("[bright_blue]Bright blue text[/bright_blue]")
print_fmt("[bright_yellow]Bright yellow text[/bright_yellow]")
print_fmt("[bright_magenta]Bright magenta text[/bright_magenta]")
print_fmt("[bright_cyan]Bright cyan text[/bright_cyan]")
```
### Input with Formatting
```python
from italica import input_fmt
# Simple formatted input
name = input_fmt("Enter your **name**: ")
# Colored input prompts
age = input_fmt("[green]How old are you?[/green] ")
email = input_fmt("[blue]Enter your email:[/blue] ")
# Complex formatting
password = input_fmt("[red]Enter your **password**:[/red] ")
```
### Convenience Functions
```python
from italica import print_bold, print_italic, print_error, print_success, print_warning
# Quick formatting functions
print_bold("This is bold!")
print_italic("This is italic!")
# Predefined message types
print_error("Something went wrong!")
print_success("Operation completed successfully!")
print_warning("Please be careful!")
```
### Direct Formatting Functions
```python
from italica import bold, italic, red, green, blue
# Format text directly
text = bold("This is bold")
colored_text = red("This is red")
# Combine formatting
formatted = bold(red("Bold red text"))
```
## API Reference
### Main Functions
#### `print_fmt(*args, sep=" ", end="\n", file=None, flush=False, enable_colors=None)`
Print formatted text with markdown-style syntax.
**Parameters:**
- `*args`: Objects to print
- `sep` (str): Separator between objects (default: " ")
- `end` (str): String appended after the last value (default: "\n")
- `file`: A file-like object to write to (default: sys.stdout)
- `flush` (bool): Whether to forcibly flush the stream (default: False)
- `enable_colors` (bool): Whether to enable color formatting. If None, auto-detects terminal support
#### `input_fmt(prompt="", enable_colors=None)`
Get user input with formatted prompt.
**Parameters:**
- `prompt` (str): The prompt to display (supports markdown formatting)
- `enable_colors` (bool): Whether to enable color formatting. If None, auto-detects terminal support
**Returns:**
- `str`: The user's input
#### `format_text(text, enable_colors=True)`
Format text with markdown-style syntax.
**Parameters:**
- `text` (str): The text to format
- `enable_colors` (bool): Whether to enable color formatting (default: True)
**Returns:**
- `str`: The formatted text with ANSI escape codes
### Convenience Functions
#### Text Formatting
- `print_bold(text, **kwargs)` - Print text in bold
- `print_italic(text, **kwargs)` - Print text in italic
- `print_error(text, **kwargs)` - Print text in red (for error messages)
- `print_success(text, **kwargs)` - Print text in green (for success messages)
- `print_warning(text, **kwargs)` - Print text in yellow (for warning messages)
#### Direct Formatting
- `bold(text)` - Make text bold
- `italic(text)` - Make text italic
- `underline(text)` - Underline text
- `strikethrough(text)` - Strikethrough text
- `code(text)` - Format text as code (monospace)
#### Colors
- `red(text)`, `green(text)`, `blue(text)`, `yellow(text)`, `magenta(text)`, `cyan(text)`
- `bright_red(text)`, `bright_green(text)`, `bright_blue(text)`, `bright_yellow(text)`, `bright_magenta(text)`, `bright_cyan(text)`
## Supported Markdown Syntax
| Syntax | Description | Example |
|--------|-------------|---------|
| `**text**` or `__text__` | Bold | `**Hello**` |
| `*text*` or `_text_` | Italic | `*World*` |
| `~~text~~` | Strikethrough | `~~Old text~~` |
| `` `text` `` | Code/monospace | `` `code` `` |
| `[color]text[/color]` | Colored text | `[red]Error[/red]` |
## Supported Colors
### Basic Colors
- `red`, `green`, `blue`, `yellow`, `magenta`, `cyan`, `white`, `black`
### Bright Colors
- `bright_red`, `bright_green`, `bright_blue`, `bright_yellow`, `bright_magenta`, `bright_cyan`, `bright_white`, `bright_black`
## Examples
### Simple Chat Application
```python
from italica import print_fmt, input_fmt
print_fmt("[cyan]=== Welcome to Chat App ===[/cyan]")
print_fmt("")
name = input_fmt("Enter your **name**: ")
print_fmt(f"Hello **{name}**! Welcome to the chat.")
while True:
message = input_fmt(f"[green]{name}[/green]: ")
if message.lower() == 'quit':
print_fmt("[yellow]Goodbye![/yellow]")
break
print_fmt(f"[blue]You said:[/blue] {message}")
```
### Error Handling
```python
from italica import print_fmt, print_error, print_success, print_warning
def process_data(data):
try:
# Process data
result = data * 2
print_success(f"Data processed successfully: {result}")
return result
except ValueError:
print_error("Invalid data format!")
except Exception as e:
print_warning(f"Unexpected error: {e}")
# Usage
process_data(5) # Success
process_data("invalid") # Error
```
### Progress Indicator
```python
from italica import print_fmt
import time
def show_progress():
steps = ["Loading...", "Processing...", "Saving...", "Complete!"]
colors = ["yellow", "blue", "green", "bright_green"]
for step, color in zip(steps, colors):
print_fmt(f"[{color}]{step}[/{color}]")
time.sleep(1)
show_progress()
```
## Platform Support
### Windows
- ✅ Full support with colorama (optional dependency)
- ✅ ANSI colors work in modern terminals (Windows 10+)
- ✅ Fallback to plain text if colors not supported
### macOS
- ✅ Full support
- ✅ Native ANSI color support
- ✅ Works in Terminal.app, iTerm2, and other terminals
### Linux
- ✅ Full support
- ✅ Native ANSI color support
- ✅ Works in all major terminals
## Installation for Development
```bash
# Clone the repository
git clone https://github.com/7vntii/italica.git
cd italica
# Install in development mode
pip install -e .
# Run tests
python -m pytest tests/
```
## 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](LICENSE) file for details.
## Author
**7vntii**
- GitHub: [https://github.com/7vntii](https://github.com/7vntii)
- PyPI: [https://pypi.org/user/7vntii](https://pypi.org/user/7vntii)
- Email: jj9dptr57@mozmail.com
- YouTube: [https://www.youtube.com/@7vntii](https://www.youtube.com/@7vntii)
## Changelog
### Version 1.0.0
- Initial release
- Markdown-style formatting support
- Color support with 16 colors
- Cross-platform compatibility
- Auto-detection of terminal color support
- Convenience functions for common use cases
## Acknowledgments
- Inspired by the need for simple, beautiful terminal output
- Built with cross-platform compatibility in mind
- Uses ANSI escape codes for maximum compatibility
Raw data
{
"_id": null,
"home_page": "https://github.com/7vntii/italica",
"name": "italica",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "7vntii <jj9dptr57@mozmail.com>",
"keywords": "markdown, formatting, print, input, italic, bold, terminal, console",
"author": "7vntii",
"author_email": "7vntii <jj9dptr57@mozmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e1/b0/a57b501e127221fdd17739f16c6e021d9d3c458a170ca0fb7a5e023e71f7/italica-1.0.0.tar.gz",
"platform": null,
"description": "# Italica\r\n\r\nA simple and elegant Python library for adding markdown-style formatting to print and input functions. Make your terminal output beautiful with bold, italic, colors, and more!\r\n\r\n[](https://badge.fury.io/py/italica)\r\n[](https://pypi.org/project/italica/)\r\n[](https://opensource.org/licenses/MIT)\r\n\r\n## Features\r\n\r\n- \ud83c\udfa8 **Markdown-style formatting** - Use familiar syntax like `**bold**`, `*italic*`, `~~strikethrough~~`\r\n- \ud83c\udf08 **Rich color support** - 16 colors including bright variants\r\n- \ud83d\udda5\ufe0f **Cross-platform** - Works on Windows, macOS, and Linux\r\n- \u26a1 **Zero dependencies** - Uses only Python standard library\r\n- \ud83d\udd27 **Easy to use** - Drop-in replacement for `print()` and `input()`\r\n- \ud83c\udfaf **Auto-detection** - Automatically detects terminal color support\r\n\r\n## Installation\r\n\r\n```bash\r\npip install italica\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\nfrom italica import print_fmt, input_fmt\r\n\r\n# Print formatted text\r\nprint_fmt(\"Hello **world**!\") # Bold text\r\nprint_fmt(\"This is *italic*\") # Italic text\r\nprint_fmt(\"[red]Error message[/red]\") # Red text\r\n\r\n# Get input with formatted prompt\r\nname = input_fmt(\"Enter your **name**: \")\r\nage = input_fmt(\"[green]How old are you?[/green] \")\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Formatting\r\n\r\n```python\r\nfrom italica import print_fmt\r\n\r\n# Bold text\r\nprint_fmt(\"This is **bold** text\")\r\n\r\n# Italic text \r\nprint_fmt(\"This is *italic* text\")\r\n\r\n# Strikethrough\r\nprint_fmt(\"This is ~~crossed out~~ text\")\r\n\r\n# Code/monospace\r\nprint_fmt(\"This is `code` text\")\r\n\r\n# Combined formatting\r\nprint_fmt(\"This is **bold** and *italic* and ~~strikethrough~~\")\r\n```\r\n\r\n### Colors\r\n\r\n```python\r\nfrom italica import print_fmt\r\n\r\n# Basic colors\r\nprint_fmt(\"[red]Red text[/red]\")\r\nprint_fmt(\"[green]Green text[/green]\")\r\nprint_fmt(\"[blue]Blue text[/blue]\")\r\nprint_fmt(\"[yellow]Yellow text[/yellow]\")\r\nprint_fmt(\"[magenta]Magenta text[/magenta]\")\r\nprint_fmt(\"[cyan]Cyan text[/cyan]\")\r\n\r\n# Bright colors\r\nprint_fmt(\"[bright_red]Bright red text[/bright_red]\")\r\nprint_fmt(\"[bright_green]Bright green text[/bright_green]\")\r\nprint_fmt(\"[bright_blue]Bright blue text[/bright_blue]\")\r\nprint_fmt(\"[bright_yellow]Bright yellow text[/bright_yellow]\")\r\nprint_fmt(\"[bright_magenta]Bright magenta text[/bright_magenta]\")\r\nprint_fmt(\"[bright_cyan]Bright cyan text[/bright_cyan]\")\r\n```\r\n\r\n### Input with Formatting\r\n\r\n```python\r\nfrom italica import input_fmt\r\n\r\n# Simple formatted input\r\nname = input_fmt(\"Enter your **name**: \")\r\n\r\n# Colored input prompts\r\nage = input_fmt(\"[green]How old are you?[/green] \")\r\nemail = input_fmt(\"[blue]Enter your email:[/blue] \")\r\n\r\n# Complex formatting\r\npassword = input_fmt(\"[red]Enter your **password**:[/red] \")\r\n```\r\n\r\n### Convenience Functions\r\n\r\n```python\r\nfrom italica import print_bold, print_italic, print_error, print_success, print_warning\r\n\r\n# Quick formatting functions\r\nprint_bold(\"This is bold!\")\r\nprint_italic(\"This is italic!\")\r\n\r\n# Predefined message types\r\nprint_error(\"Something went wrong!\")\r\nprint_success(\"Operation completed successfully!\")\r\nprint_warning(\"Please be careful!\")\r\n```\r\n\r\n### Direct Formatting Functions\r\n\r\n```python\r\nfrom italica import bold, italic, red, green, blue\r\n\r\n# Format text directly\r\ntext = bold(\"This is bold\")\r\ncolored_text = red(\"This is red\")\r\n\r\n# Combine formatting\r\nformatted = bold(red(\"Bold red text\"))\r\n```\r\n\r\n## API Reference\r\n\r\n### Main Functions\r\n\r\n#### `print_fmt(*args, sep=\" \", end=\"\\n\", file=None, flush=False, enable_colors=None)`\r\n\r\nPrint formatted text with markdown-style syntax.\r\n\r\n**Parameters:**\r\n- `*args`: Objects to print\r\n- `sep` (str): Separator between objects (default: \" \")\r\n- `end` (str): String appended after the last value (default: \"\\n\")\r\n- `file`: A file-like object to write to (default: sys.stdout)\r\n- `flush` (bool): Whether to forcibly flush the stream (default: False)\r\n- `enable_colors` (bool): Whether to enable color formatting. If None, auto-detects terminal support\r\n\r\n#### `input_fmt(prompt=\"\", enable_colors=None)`\r\n\r\nGet user input with formatted prompt.\r\n\r\n**Parameters:**\r\n- `prompt` (str): The prompt to display (supports markdown formatting)\r\n- `enable_colors` (bool): Whether to enable color formatting. If None, auto-detects terminal support\r\n\r\n**Returns:**\r\n- `str`: The user's input\r\n\r\n#### `format_text(text, enable_colors=True)`\r\n\r\nFormat text with markdown-style syntax.\r\n\r\n**Parameters:**\r\n- `text` (str): The text to format\r\n- `enable_colors` (bool): Whether to enable color formatting (default: True)\r\n\r\n**Returns:**\r\n- `str`: The formatted text with ANSI escape codes\r\n\r\n### Convenience Functions\r\n\r\n#### Text Formatting\r\n- `print_bold(text, **kwargs)` - Print text in bold\r\n- `print_italic(text, **kwargs)` - Print text in italic\r\n- `print_error(text, **kwargs)` - Print text in red (for error messages)\r\n- `print_success(text, **kwargs)` - Print text in green (for success messages)\r\n- `print_warning(text, **kwargs)` - Print text in yellow (for warning messages)\r\n\r\n#### Direct Formatting\r\n- `bold(text)` - Make text bold\r\n- `italic(text)` - Make text italic\r\n- `underline(text)` - Underline text\r\n- `strikethrough(text)` - Strikethrough text\r\n- `code(text)` - Format text as code (monospace)\r\n\r\n#### Colors\r\n- `red(text)`, `green(text)`, `blue(text)`, `yellow(text)`, `magenta(text)`, `cyan(text)`\r\n- `bright_red(text)`, `bright_green(text)`, `bright_blue(text)`, `bright_yellow(text)`, `bright_magenta(text)`, `bright_cyan(text)`\r\n\r\n## Supported Markdown Syntax\r\n\r\n| Syntax | Description | Example |\r\n|--------|-------------|---------|\r\n| `**text**` or `__text__` | Bold | `**Hello**` |\r\n| `*text*` or `_text_` | Italic | `*World*` |\r\n| `~~text~~` | Strikethrough | `~~Old text~~` |\r\n| `` `text` `` | Code/monospace | `` `code` `` |\r\n| `[color]text[/color]` | Colored text | `[red]Error[/red]` |\r\n\r\n## Supported Colors\r\n\r\n### Basic Colors\r\n- `red`, `green`, `blue`, `yellow`, `magenta`, `cyan`, `white`, `black`\r\n\r\n### Bright Colors\r\n- `bright_red`, `bright_green`, `bright_blue`, `bright_yellow`, `bright_magenta`, `bright_cyan`, `bright_white`, `bright_black`\r\n\r\n## Examples\r\n\r\n### Simple Chat Application\r\n\r\n```python\r\nfrom italica import print_fmt, input_fmt\r\n\r\nprint_fmt(\"[cyan]=== Welcome to Chat App ===[/cyan]\")\r\nprint_fmt(\"\")\r\n\r\nname = input_fmt(\"Enter your **name**: \")\r\nprint_fmt(f\"Hello **{name}**! Welcome to the chat.\")\r\n\r\nwhile True:\r\n message = input_fmt(f\"[green]{name}[/green]: \")\r\n if message.lower() == 'quit':\r\n print_fmt(\"[yellow]Goodbye![/yellow]\")\r\n break\r\n print_fmt(f\"[blue]You said:[/blue] {message}\")\r\n```\r\n\r\n### Error Handling\r\n\r\n```python\r\nfrom italica import print_fmt, print_error, print_success, print_warning\r\n\r\ndef process_data(data):\r\n try:\r\n # Process data\r\n result = data * 2\r\n print_success(f\"Data processed successfully: {result}\")\r\n return result\r\n except ValueError:\r\n print_error(\"Invalid data format!\")\r\n except Exception as e:\r\n print_warning(f\"Unexpected error: {e}\")\r\n\r\n# Usage\r\nprocess_data(5) # Success\r\nprocess_data(\"invalid\") # Error\r\n```\r\n\r\n### Progress Indicator\r\n\r\n```python\r\nfrom italica import print_fmt\r\nimport time\r\n\r\ndef show_progress():\r\n steps = [\"Loading...\", \"Processing...\", \"Saving...\", \"Complete!\"]\r\n colors = [\"yellow\", \"blue\", \"green\", \"bright_green\"]\r\n \r\n for step, color in zip(steps, colors):\r\n print_fmt(f\"[{color}]{step}[/{color}]\")\r\n time.sleep(1)\r\n\r\nshow_progress()\r\n```\r\n\r\n## Platform Support\r\n\r\n### Windows\r\n- \u2705 Full support with colorama (optional dependency)\r\n- \u2705 ANSI colors work in modern terminals (Windows 10+)\r\n- \u2705 Fallback to plain text if colors not supported\r\n\r\n### macOS\r\n- \u2705 Full support\r\n- \u2705 Native ANSI color support\r\n- \u2705 Works in Terminal.app, iTerm2, and other terminals\r\n\r\n### Linux\r\n- \u2705 Full support\r\n- \u2705 Native ANSI color support\r\n- \u2705 Works in all major terminals\r\n\r\n## Installation for Development\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/7vntii/italica.git\r\ncd italica\r\n\r\n# Install in development mode\r\npip install -e .\r\n\r\n# Run tests\r\npython -m pytest tests/\r\n```\r\n\r\n## 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## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Author\r\n\r\n**7vntii**\r\n- GitHub: [https://github.com/7vntii](https://github.com/7vntii)\r\n- PyPI: [https://pypi.org/user/7vntii](https://pypi.org/user/7vntii)\r\n- Email: jj9dptr57@mozmail.com\r\n- YouTube: [https://www.youtube.com/@7vntii](https://www.youtube.com/@7vntii)\r\n\r\n## Changelog\r\n\r\n### Version 1.0.0\r\n- Initial release\r\n- Markdown-style formatting support\r\n- Color support with 16 colors\r\n- Cross-platform compatibility\r\n- Auto-detection of terminal color support\r\n- Convenience functions for common use cases\r\n\r\n## Acknowledgments\r\n\r\n- Inspired by the need for simple, beautiful terminal output\r\n- Built with cross-platform compatibility in mind\r\n- Uses ANSI escape codes for maximum compatibility\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple library for adding markdown-style formatting to print and input functions",
"version": "1.0.0",
"project_urls": {
"Bug Reports": "https://github.com/7vntii/italica/issues",
"Documentation": "https://github.com/7vntii/italica#readme",
"Homepage": "https://github.com/7vntii/italica",
"Repository": "https://github.com/7vntii/italica",
"Source Code": "https://github.com/7vntii/italica"
},
"split_keywords": [
"markdown",
" formatting",
" print",
" input",
" italic",
" bold",
" terminal",
" console"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8c357b05fbe1df300333e1e3c14bdcb50ae8bceeeefa09d92d10b5761a2936c1",
"md5": "87ad594b0d0a1a2da0ff58faa5ddf502",
"sha256": "0149687c734a0b79b73b308b94f2f5aee70224c3eba2d24407ca545f57201ed1"
},
"downloads": -1,
"filename": "italica-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "87ad594b0d0a1a2da0ff58faa5ddf502",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10288,
"upload_time": "2025-08-08T20:52:30",
"upload_time_iso_8601": "2025-08-08T20:52:30.961044Z",
"url": "https://files.pythonhosted.org/packages/8c/35/7b05fbe1df300333e1e3c14bdcb50ae8bceeeefa09d92d10b5761a2936c1/italica-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e1b0a57b501e127221fdd17739f16c6e021d9d3c458a170ca0fb7a5e023e71f7",
"md5": "db521c700c142b56360e38dfd0c8678c",
"sha256": "1accad82a2ba357c5105080b32a2e5109bdf855d9302c77c865a90d3abf756b5"
},
"downloads": -1,
"filename": "italica-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "db521c700c142b56360e38dfd0c8678c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 14716,
"upload_time": "2025-08-08T20:52:32",
"upload_time_iso_8601": "2025-08-08T20:52:32.222376Z",
"url": "https://files.pythonhosted.org/packages/e1/b0/a57b501e127221fdd17739f16c6e021d9d3c458a170ca0fb7a5e023e71f7/italica-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-08 20:52:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "7vntii",
"github_project": "italica",
"github_not_found": true,
"lcname": "italica"
}