Quick Reference

A comprehensive index of all functions, methods, and classes in the Vargula library. Click any item to jump to its full documentation in the API reference.


Instance Creation

Function

Description

Vargula()

Create an instance of Vargula to access its methods

Core Styling Functions

Function

Description

style()

Apply styling to text directly with colors and text decorations

format()

Format text using HTML-like markup tags for inline styling

create()

Create a custom reusable style tag for use with format()

delete()

Delete a previously created custom style tag

write()

Format and print text with markup in one call

strip()

Remove all markup tags from text, leaving only plain text

clean()

Remove all ANSI escape codes from text

length()

Calculate the visible length of text, ignoring ANSI escape codes

enable()

Globally enable all styling output

disable()

Globally disable all styling output

temporary()

Context manager for temporary custom styles


Theme Functions

Function

Description

set_theme()

Set a predefined or custom theme for consistent styling


Table Functions

Class/Method

Description

Table()

Create a Rich-style table with extensive customization options

Table.add_column()

Add a column definition to the table

Table.add_row()

Add a row of data to the table


Progress Bar Functions

Class/Method/Function

Description

ProgressBar()

Create a customizable progress bar for tracking operations

ProgressBar.update()

Update the progress bar by advancing it n steps

ProgressBar.close()

Complete and close the progress bar

progress_bar()

Wrap an iterable with a progress bar for automatic tracking

MultiProgress()

Manage multiple progress bars simultaneously

MultiProgress.add_task()

Add a new progress task to the multi-progress display

MultiProgress.update()

Update a specific task in the multi-progress display


Color Palette Generation

Function

Description

generate_palette()

Generate a color palette based on color theory principles

generate_theme_palette()

Generate a complete theme with semantic color names

generate_accessible_theme()

Generate a theme with colors validated for WCAG contrast

preview_palette()

Generate a visual text preview of a color palette

apply_palette_theme()

Apply a generated palette as the active theme


Color Manipulation Functions

Function

Description

lighten()

Increase the brightness (value in HSV) of a color

darken()

Decrease the brightness (value in HSV) of a color

saturate()

Increase the saturation of a color, making it more vivid

desaturate()

Decrease the saturation of a color, making it more gray

shift_hue()

Rotate the hue of a color by specified degrees on the color wheel

invert()

Invert a color by flipping its RGB values

mix()

Mix two colors together with a specified weight


Accessibility Functions

Function

Description

calculate_contrast_ratio()

Calculate WCAG 2.1 contrast ratio between two colors

meets_wcag()

Check if two colors meet WCAG contrast requirements

ensure_contrast()

Automatically adjust a foreground color to meet minimum contrast


Color Blindness Functions

Function

Description

simulate_colorblindness()

Simulate how a color appears to individuals with color blindness

validate_colorblind_safety()

Check if colors in a palette remain distinguishable


Persistence Functions

Function

Description

save_palette()

Save a color palette to a JSON file

load_palette()

Load a color palette from a JSON file

save_theme()

Save a theme palette to a JSON file

load_theme()

Load a theme palette from a JSON file


Function Categories

By Use Case

Instance Creation:

  • Vargula() - Creating an instance of Vargula

Text Styling:

Style Management:

Text Processing:

UI Components:

Color Generation:

Color Editing:

Accessibility:

Data Persistence:


Alphabetical Index

A-D

E-L

M-S

T-Z

apply_palette_theme()

enable()

meets_wcag()

Table()

calculate_contrast_ratio()

ensure_contrast()

mix()

Table.add_column()

clean()

format()

MultiProgress()

Table.add_row()

create()

generate_accessible_theme()

MultiProgress.add_task()

temporary()

darken()

generate_palette()

MultiProgress.update()

validate_colorblind_safety()

delete()

generate_theme_palette()

preview_palette()

write()

desaturate()

invert()

progress_bar()

disable()

length()

ProgressBar()

lighten()

ProgressBar.close()

load_palette()

ProgressBar.update()

load_theme()

saturate()

save_palette()

save_theme()

set_theme()

shift_hue()

simulate_colorblindness()

strip()

style()


Common Workflows

Basic Text Styling

  1. style() - For simple, direct styling

  2. format() - For markup-based styling

  3. write() - For styled printing

Custom Style System

  1. create() - Define custom styles

  2. format() - Use custom styles

  3. delete() - Clean up when done

Theme Creation

  1. generate_theme_palette() - Generate theme

  2. preview_palette() - Preview colors

  3. apply_palette_theme() - Apply theme

  4. save_theme() - Save for later

Accessible Design

  1. generate_accessible_theme() - Create compliant theme

  2. calculate_contrast_ratio() - Verify contrast

  3. meets_wcag() - Check compliance

  4. simulate_colorblindness() - Test visibility

Data Visualization

  1. Table() - Create table

  2. Table.add_column() - Define columns

  3. Table.add_row() - Add data

Progress Tracking

  1. ProgressBar() - Create progress bar

  2. ProgressBar.update() - Update progress

  3. ProgressBar.close() - Finish


Quick Start Examples

Styling Text

from vargula import Vargula
vg = Vargula()

# Direct styling
print(vg.style("Error", color="red", look="bold"))

# Markup styling
print(vg.format("This is <red>red</red> and <bold>bold</bold>"))

# Custom styles
vg.create("error", color="red", look="bold")
print(vg.format("<error>Error!</error>"))

Creating Tables

table = vg.Table(title="Report")
table.add_column("Name", style="cyan")
table.add_column("Score", style="green", justify="right")
table.add_row("Alice", "95")
table.add_row("Bob", "87")
print(table)

Progress Bars

import time

# Simple progress bar
for i in vg.progress_bar(range(100), desc="Processing"):
    time.sleep(0.01)

# Multiple progress bars
with vg.MultiProgress() as mp:
    task1 = mp.add_task("Download", total=100)
    task2 = mp.add_task("Extract", total=50)
    # ... update tasks

Color Palettes

# Generate palette
colors = vg.generate_palette("#3498db", "complementary", 5)

# Preview colors
print(vg.preview_palette(colors))

# Create theme
theme = vg.generate_theme_palette("analogous", "#e74c3c")
vg.apply_palette_theme(theme)

Parameter Quick Reference

Common Parameters

Color Parameters: (used in style(), create(), etc.)

  • color - Foreground color (name, hex, or RGB tuple)

  • bg - Background color (name, hex, or RGB tuple)

Look Parameters:

  • look - Text decoration(s) (string or list)

    • Options: bold, dim, italic, underline, blink, reverse, hidden, strikethrough

Table Parameters:

  • title - Table title

  • caption - Table caption

  • style - Default cell style

  • box - Border style: "rounded", "square", "double", "heavy", "minimal", "none"

  • show_header - Display header row (bool)

  • show_lines - Show lines between rows (bool)

  • padding - Cell padding as (vertical, horizontal)

  • expand - Expand to full width (bool)

Progress Bar Parameters:

  • total - Total iterations

  • desc - Description text

  • unit - Unit name (e.g., “files”, “items”)

  • bar_width - Width in characters

  • show_percentage - Display percentage (bool)

  • show_count - Display count (bool)

  • show_rate - Display rate (bool)

  • show_eta - Display ETA (bool)

Palette Generation Parameters:

  • base_color - Starting hex color

  • scheme - Color harmony scheme

  • count - Number of colors to generate

  • saturation_range - Min/max saturation (0-1)

  • value_range - Min/max brightness (0-1)

WCAG Parameters:

  • level - Compliance level: "AA" or "AAA"

  • large_text - Text is 18pt+ or 14pt+ bold (bool)

  • min_contrast - Minimum contrast ratio (float)


Return Type Quick Reference

Function

Returns

style()

str - Styled string with ANSI codes

format()

str - Formatted string with ANSI codes

create()

None

delete()

bool - True if deleted, False if not found

write()

None - Prints to stdout

strip()

str - Plain text without markup

clean()

str - Plain text without ANSI codes

length()

int - Visible character count

generate_palette()

list[str] - List of hex colors

generate_theme_palette()

dict - Theme dictionary

generate_accessible_theme()

dict - Theme dictionary

preview_palette()

str - Formatted preview string

lighten()

str - Hex color

darken()

str - Hex color

saturate()

str - Hex color

desaturate()

str - Hex color

shift_hue()

str - Hex color

invert()

str - Hex color

mix()

str - Hex color

calculate_contrast_ratio()

float - Contrast ratio (1-21)

meets_wcag()

bool - Compliance status

ensure_contrast()

str - Adjusted hex color

simulate_colorblindness()

str - Simulated hex color

validate_colorblind_safety()

tuple - (bool, list of problems)

load_palette()

tuple - (colors list, metadata dict)

load_theme()

tuple - (theme dict, metadata dict)

MultiProgress.add_task()

int - Task ID


Last Updated: 2025-11-30
Library Version: 2.0.0