Created
July 22, 2025 20:57
-
-
Save mgaitan/369a0979c8566adb9286cb5b627e02bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httpx | |
from pyfiglet import Figlet | |
from rich.console import Console | |
from rich.text import Text | |
def gradient(text, start=(255, 0, 0), end=(0, 255, 255)): | |
lines = text.splitlines() | |
width = max(len(line) for line in lines) | |
grad = [( | |
int(start[0] + (end[0] - start[0]) * i / (width - 1)), | |
int(start[1] + (end[1] - start[1]) * i / (width - 1)), | |
int(start[2] + (end[2] - start[2]) * i / (width - 1)) | |
) for i in range(width)] | |
grad_hex = [f"#{r:02x}{g:02x}{b:02x}" for r, g, b in grad] | |
out = Text() | |
for line in lines: | |
for i, c in enumerate(line.ljust(width)): | |
out.append(c, style=grad_hex[i]) | |
out.append("\n") | |
return out | |
ascii_art = Figlet(font="slant").renderText("Shiphero Tools") | |
console = Console() | |
console.print(gradient(ascii_art)) | |
console.print("\n".join([v for k, v in httpx.get("https://v2.jokeapi.dev/joke/Any").json().items() if k in ("joke", "setup", "delivery")])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment