Skip to content

dwgx/SmartCLI / skills/cmd-art

cmd-art

Verified

Design and render terminal/CMD visual effects and ASCII art from a one-line request via the pluggable `fx` engine (30 effects, hot-swappable and themeable, plus scripted shows). Effects include donut, matrix rain, plasma, fire, a spinning 3D ball, a solar-system orrery, Game of Life, wireframe cube, 3D text banners, rainbow/lolcat gradient text, starfield, tunnel, fireworks, image-to-ASCII, and more. Use when the request is for a terminal animation, ANSI/CLI art, or a new console effect. Pure Python stdlib; truecolor.

fx/effects/sparkle.py

View on GitHub
"""Sparkle/shimmer: dim centered text with short-lived bright glints on top.

Each frame spawns a few random sparkles with a TTL; brightness lerps from
theme.primary toward white and dies out. Source: research/R1 part D.6.
"""
from __future__ import annotations

import random

from ..core import RESET, rgb
from ..base import Effect, FrameCtx, Param
from ..registry import register
from ..theme import lerp_color
from ..util import grid_to_str, new_grid

SPARK_CHARS = "*+.\u00b7"


@register
class Sparkle(Effect):
    name = "sparkle"
    description = "Dim text under a field of short-lived bright glints."
    tags = ("text", "particles")
    default_fps = 20.0
    params = (
        Param("text", "str", "* S P A R K L E *", "centered text (empty for none)"),
        Param("density", "float", 1.0, "sparkle spawn multiplier", min=0.0, max=8.0),
    )

    def setup(self) -> None:
        self._sparks = {}  # (x, y) -> [ttl, max_ttl, char]

    def render(self, ctx: FrameCtx) -> str:
        w, h = ctx.width, ctx.height
        theme = ctx.theme
        grid = new_grid(w, h)

        # dim base text, centered
        text = ctx.params["text"]
        if text:
            y = h // 2
            x0 = max(0, (w - len(text)) // 2)
            dim = theme.color_at(0.35)
            for i, ch in enumerate(text):
                if ch != " " and 0 <= x0 + i < w:
                    grid[y][x0 + i] = (ch, dim)

        # spawn sparkles
        spawn = max(1, int(w * h / 220 * ctx.params["density"]))
        for _ in range(spawn):
            x, y = random.randrange(w), random.randrange(h)
            if (x, y) not in self._sparks:
                ttl = random.randint(3, 10)
                self._sparks[(x, y)] = [ttl, ttl, random.choice(SPARK_CHARS)]

        # age + draw sparkles
        dead = []
        for (x, y), s in self._sparks.items():
            s[0] -= 1
            if s[0] <= 0:
                dead.append((x, y))
                continue
            a = s[0] / s[1]
            grid[y % h][x % w] = (s[2], lerp_color(theme.primary, (255, 255, 255), a))
        for k in dead:
            del self._sparks[k]
        return grid_to_str(grid)

    def teardown(self) -> None:
        self._sparks = {}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall