21 lines
811 B
Python
21 lines
811 B
Python
import subprocess
|
|
|
|
|
|
def generate(text, font="smblock", filter_effect=None, colors=None):
|
|
command = ["toilet", "-f", font]
|
|
if filter_effect:
|
|
command.extend(["-F", filter_effect])
|
|
if colors:
|
|
# Toilet uses a specific format for color arguments, e.g., --gay or --metal
|
|
# For general colors, you might need to use specific filters or direct color codes.
|
|
# This example focuses on filters that inherently use colors.
|
|
pass # More complex color handling would be needed for arbitrary colors
|
|
|
|
command.append(text)
|
|
|
|
try:
|
|
result = subprocess.run(command, capture_output=True, text=True, check=True)
|
|
return result.stdout
|
|
except subprocess.CalledProcessError as e:
|
|
return f"Error executing toilet: {e}\n{e.stderr}"
|