Ascii Art
aceternity/ascii-artFreeComponent
aceternity publishes no description for this item.
Install it
npx shadcn@latest add https://ui.aceternity.com/registry/ascii-art.jsonSource
1"use client";2import React, {3 useEffect,4 useLayoutEffect,5 useRef,6 useState,7 useCallback,8 useId,9} from "react";10import { motion, useInView } from "motion/react";11import { cn } from "@/lib/utils";1213const useIsomorphicLayoutEffect =14 typeof window !== "undefined" ? useLayoutEffect : useEffect;1516const ASCII_CHARSETS = {17 standard: " .,:;i1tfLCG08@",18 blocks: " ░▒▓█",19 binary: " 01",20 dots: " ·•●",21 minimal: " .:░▒",22 dense: " .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",23 arrows: " ←↑→↓↔↕↖↗↘↙",24 stars: " ·✦✧★",25 hash: " -=#",26 pipes: " |/─\\│",27 braille: " ⠁⠃⠇⠏⠟⠿⡿⣿",28 circles: " ○◔◑◕●",29 squares: " ▢▣▤▥▦▧▨▩",30 hearts: " ♡♥",31 math: " +-×÷=≠≈∞",32} as const;3334type CharsetPreset = keyof typeof ASCII_CHARSETS;3536const isCharsetPreset = (value: string): value is CharsetPreset => {37 return value in ASCII_CHARSETS;38};3940const resolveCharset = (charset: string): string => {41 if (isCharsetPreset(charset)) {42 return ASCII_CHARSETS[charset];43 }44 return charset;45};4647const resolveCssColor = (48 color: string,49 element: HTMLElement | null50): string => {51 if (!color) return color;5253 if (color.startsWith("var(")) {54 if (!element) return "#ffffff";5556 const tempDiv = document.createElement("div");57 tempDiv.style.color = color;58 element.appendChild(tempDiv);59 const computedColor = getComputedStyle(tempDiv).color;60 element.removeChild(tempDiv);61 return computedColor || "#ffffff";62 }6364 return color;65};6667type AsciiArtProps = {68 src: string;69 /** Number of ASCII columns (character resolution). Higher = more detail. */70 resolution?: number;71 /** Charset preset name ("standard", "blocks", "binary", etc.) or custom character string */72 charset?: CharsetPreset | string;73 /** Text color for the ASCII art (ignored if colored=true) */74 color?: string;75 /** Background color */76 backgroundColor?: string;77 /** Convert to inverted colors (dark bg, light text) */78 inverted?: boolean;79 /** Enable colored ASCII (uses image colors) */80 colored?: boolean;81 /** Enable animation on load */82 animated?: boolean;83 /** Animation style */84 animationStyle?: "fade" | "typewriter" | "matrix" | "none";85 /** Duration for fade animation in seconds */86 animationDuration?: number;87 /** Font family for ASCII characters */88 fontFamily?: string;89// … truncated
What it pulls in
npm packages
Files it writes
More from aceternity
All 276 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3d Card3d-card | aceternity | Components | Free | no deps | |
| 3d Globe3d-globe | aceternity | Components | Free | 3 deps | |
| 3d Marquee3d-marquee | aceternity | Components | Free | no deps | |
| 3d Pin3d-pin | aceternity | Components | Free | 1 dep | |
| Animated Modalanimated-modal | aceternity | Components | Free | 1 dep | |
| Animated Testimonialsanimated-testimonials | aceternity | Components | Free | 2 deps | |
| Animated Tooltipanimated-tooltip | aceternity | Components | Free | 1 dep | |
| Apple Cards Carouselapple-cards-carousel | aceternity | Components | Free | 2 deps |
