Skip to main content

A tool for generating customizable ASCII art messages with speech bubbles and cow-style templates, supporting styled text using AnsiMarkup.

Project description

ccowsay

screenshot

🐮 A tool for generating customizable ASCII art messages with speech bubbles and cow-style templates, supporting styled text using AnsiMarkup.

Features

  • Custom .ccow templates define ASCII art structure.
  • Styled text formatting (colors, bold, italic, underline) via AnsiMarkup.
  • Text alignment (left, center, right), word wrapping, and whitespace replacement.
  • Dynamic template variables (eyes, tongue, etc.) that can be overridden.
  • Simple configuration directory for templates and defaults.

Installation

pipx install ccowsay

Basic Usage

ccowsay "Hello World!"

For full details of supported tags and syntax see the AnsiMarkup documentation.

Command-Line Options

Option Description Default
-f, --format Path or alias to a .ccow template @/cow.ccow
-a, --align Text alignment: left, center, right left
-w, --wrap Max width before wrapping (use -1 to disable wrapping) 40
--replace-whitespace Replace tabs/newlines with spaces False
-c, --corners Four characters for bubble corners (TL, TR, BL, BR) / \ / \
-s, --sides Four characters for bubble sides (top, bottom, left, right) | - | -
-v, --values JSON string of template variable overrides {}
-l, --list List available .ccow templates
--get Download a .ccow template from a GitHub repository and save it to the user config directory

Custom Templates

Templates live in your config directory (e.g., ~/.config/ccowsay/). Each .ccow file has two parts: JSON metadata, then ASCII art, separated by ---. Example:

{
  "eyes": "oo",
  "tongue": "  "
}
---
{message}
        {backslash}   ^__^
         {backslash}  ({eyes})\_______
            (__)\       )\/\
             {tongue} ||----w |
                ||     ||

Override variables with --values, for example:

ccowsay -f "@/cow.ccow" -v '{"eyes": "xx", "tongue": "U "}' "I'm tired..."

Coloring with XML-Style Tags

You can use XML-style tags from ansimarkup to add colors, bold, or italic text inside your .ccow templates.

[!WARNING] Do not use these tags directly in messages passed to ccowsay — they are intended for ASCII art templates only.

Example inside a .ccow file:

{
  "eyes": "oo",
  "tongue": "  "
}
---
<red>{message}</red>
        {backslash}   ^__^
         {backslash}  (<green>{eyes}</green>)\_______
            (__)\       )\/\
             {tongue} ||----w |
                ||     ||

This ensures that all colors and styles are applied safely when rendering the ASCII art.

Using Templates from the Config Directory

Any .ccow file placed in your user config directory (usually ~/.config/ccowsay/) can be referenced using the @/ prefix.

For example:

ccowsay -f "@/cow.ccow" "Hello World!"
  • @/cow refers to cow.ccow inside your config directory.
  • This works for any custom template you add there.
  • The default configuration also uses this syntax to load the built-in cow.

Downloading Templates

Use --get flag to download and store .ccow files locally:

ccowsay --get path/to/file.ccow

For more details, check out ccows.

Embedding in Python

from ccowsay import ccowsay, TextAlign

ascii_art = ccowsay(
    "<green>Hello from code!</green>",
    open("cow.ccow").read(),
    align=TextAlign.CENTER,
    width=40,
    eyes="oO",
    tongue="U "
)
print(ascii_art)

License

MIT License — free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccowsay-2.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccowsay-2.0.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file ccowsay-2.0.0.tar.gz.

File metadata

  • Download URL: ccowsay-2.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.17.7-300.fc43.x86_64

File hashes

Hashes for ccowsay-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ee0896c98a949a2a7b1c321fd46e7199a337ca8318e3c0a1465a12cb9ef2f411
MD5 2c97508e43a15fe8b95d57c9e0cf8adc
BLAKE2b-256 026e71904c8c2f99b960a835cbb50f601e832331480159f846c21b8ce0b35e9a

See more details on using hashes here.

File details

Details for the file ccowsay-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ccowsay-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.17.7-300.fc43.x86_64

File hashes

Hashes for ccowsay-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9688fcc5a27ab1df6c4fcb657ee26d1e039213348c92acdca49d0fe3c614768a
MD5 de660b03153bbfb09c94d9268767d49e
BLAKE2b-256 486a43b23bd9f75b7efdeacf0de51875f8dd70ed6c90f0c67f766a188fe274c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page