Prestasi
Belum diujiBelum diuji
ASCII DitherMITCorakGodUI
Komponen React Corak oleh Lucas Bassetti. Dikumpul tanpa ubahan daripada GodUI di bawah lesen MIT dan dipaparkan secara langsung di sini.
Laporan kualiti
Gred dan skor datang daripada pemeriksaan automatik semasa binaan atau ujian. Jika suatu pemeriksaan tidak dijalankan, ia ditanda Belum diuji — nombor tidak pernah direka.
Belum diuji
Belum diuji
Belum diuji
Belum diuji
Angka datang daripada skrip automatik, bukan sampel tulisan tangan.
Dipaparkan pada saiz sebenar.
Salinan bermula dengan notis lesen. Kekalkannya apabila anda menggunakan kod.
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--radius-xl:calc(var(--radius) + 4px);--radius-2xl:1rem;--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--blur-sm:8px;--aspect-video:16 / 9;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--shadow:var(--shadow)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-\[4\/3\]{aspect-ratio:4/3}.aspect-\[4\/5\]{aspect-ratio:4/5}.aspect-\[5\/2\]{aspect-ratio:5/2}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-full{width:100%;height:100%}.h-full{height:100%}.min-h-0{min-height:0}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[16rem\]{max-width:16rem}.max-w-\[22rem\]{max-width:22rem}.max-w-\[38rem\]{max-width:38rem}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.rotate-90{rotate:90deg}.\[scrollbar-width\:thin\]{scrollbar-width:thin}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.overflow-hidden{overflow:hidden}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-border,.border-border\/60{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--border) 60%, transparent)}}.bg-card,.bg-card\/40{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\/40{background-color:color-mix(in oklab, var(--card) 40%, transparent)}}.bg-card\/80{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\/80{background-color:color-mix(in oklab, var(--card) 80%, transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-card\/90{--tw-gradient-from:var(--card)}@supports (color:color-mix(in lab, red, red)){.from-card\/90{--tw-gradient-from:color-mix(in oklab, var(--card) 90%, transparent)}}.from-card\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-cover{object-fit:cover}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.py-1{padding-block:var(--spacing)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-\[22vh\]{padding-block:22vh}.py-\[40vh\]{padding-block:40vh}.py-\[55vh\]{padding-block:55vh}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-muted-foreground{color:var(--muted-foreground)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}@media (min-width:40rem){.sm\:block{display:block}.sm\:flex-nowrap{flex-wrap:nowrap}}}:root,.light,:root[data-theme=light]{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--font-sans:var(--font-geist-sans,"Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif);--font-serif:var(--font-geist-sans,"Geist", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif);--font-mono:var(--font-geist-mono,"Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);--radius:.625rem;--shadow-2xs:0 1px 2px #00000005;--shadow-xs:0 1px 3px #0000000a;--shadow-sm:0 2px 6px #0000000d;--shadow:0 4px 12px #0000000f;--shadow-md:0 8px 20px #00000014;--shadow-lg:0 16px 32px #0000001a;--shadow-xl:0 24px 48px #0000001f;--shadow-2xl:0 40px 80px #00000029;--syntax-plain:oklch(20% .036 266);--syntax-punctuation:oklch(54% .022 266);--syntax-keyword:oklch(52% .19 302);--syntax-property:oklch(56% .11 90);--syntax-string:oklch(52% .106 168);--syntax-comment:oklch(63% .016 266);--syntax-number:oklch(54% .115 235);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--code-block:oklch(97.8% 0 0);--code-block-foreground:oklch(20.5% 0 0);--code-block-border:oklch(92.2% 0 0);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--z-base:0;--z-raised:10;--z-overlay:20;--z-sticky:30;--z-popover:40;--z-modal:50;--z-toast:60;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:61, 102, 223;--color-primary-rgb:61, 102, 223;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(55% .19 266) 0%, oklch(100% 0 0) 50%, oklch(85% .12 90) 100%);--god-glow:0 0 24px oklch(55% .19 266/.14), 0 0 80px oklch(85% .12 90/.06);--rainbow-1:oklch(55% .19 266);--rainbow-2:oklch(68% .16 305);--rainbow-3:oklch(82% .1 185);--rainbow-4:oklch(78% .12 14);--rainbow-5:oklch(80% .13 90);--rainbow-speed:2s}@media (color-gamut:p3){:root,.light{--syntax-string:oklch(52% .13 168);--syntax-number:oklch(54% .13 235)}}@media (prefers-color-scheme:dark){:root:not(.light){--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0);--syntax-plain:oklch(93.5% .01 266);--syntax-punctuation:oklch(65% .02 266);--syntax-keyword:oklch(78% .135 302);--syntax-property:oklch(83% .12 90);--syntax-string:oklch(80% .13 168);--syntax-comment:oklch(58% .02 266);--syntax-number:oklch(80% .12 224);--code-block:oklch(18.5% 0 0);--code-block-foreground:oklch(98.5% 0 0);--code-block-border:oklch(27% 0 0);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--shadow-2xs:0 1px 2px #0000001f;--shadow-xs:0 1px 3px #00000026;--shadow-sm:0 2px 6px #0003;--shadow:0 4px 12px #00000040;--shadow-md:0 8px 20px #0000004d;--shadow-lg:0 16px 32px #00000059;--shadow-xl:0 24px 48px #0006;--shadow-2xl:0 40px 80px #00000080;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:66, 108, 229;--color-primary-rgb:66, 108, 229;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(57% .19 266) 0%, oklch(100% 0 0) 50%, oklch(86% .12 90) 100%);--god-glow:0 0 24px oklch(57% .19 266/.28), 0 0 80px oklch(86% .12 90/.12);--rainbow-1:oklch(72% .145 266);--rainbow-2:oklch(74% .16 305);--rainbow-3:oklch(84% .1 185);--rainbow-4:oklch(80% .116 14);--rainbow-5:oklch(84% .13 90);--rainbow-speed:2s}}:root[data-theme=dark],.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0);--syntax-plain:oklch(93.5% .01 266);--syntax-punctuation:oklch(65% .02 266);--syntax-keyword:oklch(78% .135 302);--syntax-property:oklch(83% .12 90);--syntax-string:oklch(80% .13 168);--syntax-comment:oklch(58% .02 266);--syntax-number:oklch(80% .12 224);--code-block:oklch(18.5% 0 0);--code-block-foreground:oklch(98.5% 0 0);--code-block-border:oklch(27% 0 0);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--shadow-2xs:0 1px 2px #0000001f;--shadow-xs:0 1px 3px #00000026;--shadow-sm:0 2px 6px #0003;--shadow:0 4px 12px #00000040;--shadow-md:0 8px 20px #0000004d;--shadow-lg:0 16px 32px #00000059;--shadow-xl:0 24px 48px #0006;--shadow-2xl:0 40px 80px #00000080;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:66, 108, 229;--color-primary-rgb:66, 108, 229;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(57% .19 266) 0%, oklch(100% 0 0) 50%, oklch(86% .12 90) 100%);--god-glow:0 0 24px oklch(57% .19 266/.28), 0 0 80px oklch(86% .12 90/.12);--rainbow-1:oklch(72% .145 266);--rainbow-2:oklch(74% .16 305);--rainbow-3:oklch(84% .1 185);--rainbow-4:oklch(80% .116 14);--rainbow-5:oklch(84% .13 90);--rainbow-speed:2s}@media (color-gamut:p3){@media (prefers-color-scheme:dark){:root:not(.light){--syntax-keyword:oklch(78% .14 302);--rainbow-1:oklch(72% .15 266);--rainbow-4:oklch(80% .12 14)}}.dark{--syntax-keyword:oklch(78% .14 302);--rainbow-1:oklch(72% .15 266);--rainbow-4:oklch(80% .12 14)}}@keyframes magic-rainbow{0%{background-position:0%}to{background-position:200%}}@keyframes magic-input-indeterminate{0%{background-position:110%}to{background-position:-10%}}@keyframes magic-input-sweep{0%{background-size:0% 100%}to{background-size:100% 100%}}@keyframes magic-input-spin{to{transform:rotate(360deg)}}@keyframes shimmer-slide{to{transform:translate(calc(100cqw - 100%))}}@keyframes spin-around{0%{transform:translateZ(0)rotate(0)}15%,35%{transform:translateZ(0)rotate(90deg)}65%,85%{transform:translateZ(0)rotate(270deg)}to{transform:translateZ(0)rotate(360deg)}}@keyframes progress-fold-indeterminate{0%{transform:translate(-100%)}to{transform:translate(250%)}}@keyframes mask-button-in{0%{-webkit-mask-position:0 0;mask-position:0 0}to{-webkit-mask-position:100% 0;mask-position:100% 0}}@keyframes mask-button-out{0%{-webkit-mask-position:100% 0;mask-position:100% 0}to{-webkit-mask-position:0 0;mask-position:0 0}}@keyframes aurora-text{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}@keyframes marquee{0%{transform:translate(0)}to{transform:translateX(calc(-100% - var(--gap)))}}@keyframes marquee-vertical{0%{transform:translateY(0)}to{transform:translateY(calc(-100% - var(--gap)))}}@keyframes split-flap-fall{0%{transform:rotateX(0)}to{transform:rotateX(-90deg)}}@keyframes split-flap-rise{0%{transform:rotateX(90deg)}to{transform:rotateX(0)}}@keyframes blueprint-sweep{0%{transform:translate(-50%, -50%) rotate(var(--blueprint-angle,25deg));opacity:0}15%,85%{opacity:1}to{transform:translate(150%, 150%) rotate(var(--blueprint-angle,25deg));opacity:0}}@keyframes light-rays-sweep{0%{transform:rotate(calc(var(--rays-angle,0deg) - 6deg)) scale(1);opacity:calc(var(--rays-intensity,.6) * .7)}to{transform:rotate(calc(var(--rays-angle,0deg) + 6deg)) scale(1.08);opacity:var(--rays-intensity,.6)}}@keyframes voice-orb-spin{to{transform:rotate(360deg)}}@keyframes voice-orb-breathe{0%,to{transform:scale(1)}50%{transform:scale(1.04)}}@keyframes voice-orb-ring{0%{opacity:.6;transform:scale(.85)}to{opacity:0;transform:scale(1.4)}}@keyframes app-showcase-scroll{0%{transform:translateY(0)}to{transform:translateY(-50%)}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}// godui source (MIT). npm i clsx motion react tailwind-merge · Tailwind CSS v4
// ── ascii-dither/ascii-dither.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/ascii-dither/ascii-dither.tsx)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
"use client";
import * as React from "react";
export type AsciiDitherVariant = "ascii" | "dither";
export type AsciiDitherColor = "theme" | "source" | (string & {});
export type AsciiDitherProps = Omit<
React.HTMLAttributes<HTMLDivElement>,
"children"
> & {
/** Image or video URL to render. */
src: string;
/** Accessible label — the component is exposed as `role="img"`. */
alt?: string;
/** Source kind. `"auto"` infers video from the file extension. */
type?: "auto" | "image" | "video";
/** `"ascii"` draws luminance-mapped characters; `"dither"` draws halftone dots. */
variant?: AsciiDitherVariant;
/** Size of one cell in CSS px — smaller is finer (and heavier). */
cellSize?: number;
/** ASCII ramp from brightest to darkest. */
charset?: string;
/** Font family for the ASCII glyphs. */
fontFamily?: string;
/** Dither algorithm. */
ditherType?: "bayer" | "floyd-steinberg";
/** Quantization levels for dithering — finite integers >= 2; invalid values normalize to 2. */
levels?: number;
/** Dot shape for the dither variant. */
dotShape?: "square" | "circle";
/**
* `"theme"` inks with the `--foreground` token, `"source"` tints each cell with
* the underlying pixel, or pass any CSS color string.
*/
color?: AsciiDitherColor;
/** Canvas background. Defaults to transparent. */
background?: string;
/** Invert the luminance mapping. */
invert?: boolean;
/** Contrast multiplier around mid-gray — `>1` sharpens features, `1` is linear. */
contrast?: number;
/** Stagger the cells in from the center on first view. */
reveal?: boolean;
/** Pointer acts as a focus lens — cells outside the radius fade back. */
interactive?: boolean;
/** Ambient retro flicker — occasional row offsets and glyph scramble. */
glitch?: boolean;
/** Focus-lens radius in CSS px (with `interactive`). */
lensRadius?: number;
/** Autoplay a video source. */
autoPlay?: boolean;
/** Loop a video source. */
loop?: boolean;
/** Mute a video source (required for most browsers to autoplay). */
muted?: boolean;
/** Frame cap for video / glitch animation. */
fps?: number;
};
// 4x4 Bayer matrix, normalized to (0,1) thresholds.
const BAYER = [
[0, 8, 2, 10],
[12, 4, 14, 6],
[3, 11, 1, 9],
[15, 7, 13, 5],
].map((row) => row.map((v) => (v + 0.5) / 16));
function rgbTriple(input: string): [number, number, number] {
if (typeof document === "undefined") return [0, 0, 0];
try {
const c = document.createElement("canvas");
c.width = 1;
c.height = 1;
const ctx = c.getContext("2d", { willReadFrequently: true });
if (!ctx) return [0, 0, 0];
ctx.fillStyle = input;
ctx.fillRect(0, 0, 1, 1);
const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;
return [r as number, g as number, b as number];
} catch {
return [0, 0, 0];
}
}
const easeInOut = (t: number) =>
t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2;
const clamp01 = (v: number) => (v < 0 ? 0 : v > 1 ? 1 : v);
const normalizeLevels = (value: number) =>
Number.isFinite(value) ? Math.max(2, Math.floor(value)) : 2;
function isVideoSrc(src: string, type: AsciiDitherProps["type"]) {
if (type === "video") return true;
if (type === "image") return false;
return /\.(mp4|webm|ogg|ogv|mov|m4v)(\?|#|$)/i.test(src);
}
/**
* Renders an image or video as a live field of ASCII characters or halftone
* dither dots on a canvas. Ink follows the theme, the source colors, or any CSS
* color; cells can stagger in on view, follow a pointer focus-lens, and flicker
* with a retro glitch. View-only — drop it in any sized container.
*/
const AsciiDither = React.forwardRef<HTMLDivElement, AsciiDitherProps>(
(
{
src,
alt = "",
type = "auto",
variant = "ascii",
cellSize = 8,
charset = " .:-=+*#%@",
fontFamily = "ui-monospace, SFMono-Regular, Menlo, monospace",
ditherType = "bayer",
levels = 2,
dotShape = "square",
color = "theme",
background = "transparent",
invert = false,
contrast = 1,
reveal = true,
interactive = false,
glitch = false,
lensRadius = 120,
autoPlay = true,
loop = true,
muted = true,
fps = 30,
className,
style,
...props
},
ref,
) => {
const containerRef = React.useRef<HTMLDivElement>(null);
const canvasRef = React.useRef<HTMLCanvasElement>(null);
const fgRef = React.useRef<[number, number, number]>([0, 0, 0]);
const pointerRef = React.useRef<{ x: number; y: number; active: boolean }>({
x: 0,
y: 0,
active: false,
});
React.useImperativeHandle(
ref,
() => containerRef.current as HTMLDivElement,
);
const isVideo = isVideoSrc(src, type);
const usesTheme = color === "theme";
const normalizedLevels = normalizeLevels(levels);
const safeCellSize =
Number.isFinite(cellSize) && cellSize > 0 ? cellSize : 1;
// Resolve the theme ink color and keep it in sync with theme switches.
React.useEffect(() => {
const container = containerRef.current;
if (!container || !usesTheme) return;
const resolve = () => {
const span = document.createElement("span");
span.style.cssText =
"position:absolute;width:0;height:0;opacity:0;color:var(--foreground)";
container.appendChild(span);
fgRef.current = rgbTriple(getComputedStyle(span).color);
span.remove();
};
resolve();
const observer = new MutationObserver(resolve);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class", "data-theme", "style"],
});
return () => observer.disconnect();
}, [usesTheme]);
React.useEffect(() => {
const container = containerRef.current;
const canvas = canvasRef.current;
if (!container || !canvas) return;
const ctx = canvas.getContext("2d");
if (!ctx) return;
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
const off = document.createElement("canvas");
const octx = off.getContext("2d", { willReadFrequently: true });
if (!octx) return;
let w = 0;
let h = 0;
let cols = 0;
let rows = 0;
let cellW = safeCellSize;
let cellH = safeCellSize;
let pixels: Uint8ClampedArray | null = null;
let source: HTMLImageElement | HTMLVideoElement | null = null;
let ready = false;
let cancelled = false;
let rafId = 0;
let visible = true;
let last = 0;
let revealStart = 0;
let scramble = 0; // glitch phase counter
const frameGap = () => 1000 / Math.max(1, fps);
const needsLoop = () =>
!reduced.matches &&
((isVideo &&
source instanceof HTMLVideoElement &&
!source.paused &&
!source.ended) ||
glitch ||
(interactive && pointerRef.current.active));
const measure = () => {
w = container.clientWidth;
h = container.clientHeight;
cols = Math.max(1, Math.floor(w / safeCellSize));
rows = Math.max(1, Math.floor(h / safeCellSize));
cellW = w / cols;
cellH = h / rows;
const dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = Math.floor(w * dpr);
canvas.height = Math.floor(h * dpr);
canvas.style.width = `${w}px`;
canvas.style.height = `${h}px`;
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
off.width = cols;
off.height = rows;
};
// Draw the source "contain" into the low-res offscreen and read it back.
const sample = () => {
if (!source) return;
const sw =
source instanceof HTMLVideoElement
? source.videoWidth
: source.naturalWidth;
const sh =
source instanceof HTMLVideoElement
? source.videoHeight
: source.naturalHeight;
if (!sw || !sh) return;
const scale = Math.min(cols / sw, rows / sh);
const dw = sw * scale;
const dh = sh * scale;
octx.clearRect(0, 0, cols, rows);
octx.drawImage(source, (cols - dw) / 2, (rows - dh) / 2, dw, dh);
try {
pixels = octx.getImageData(0, 0, cols, rows).data;
} catch {
pixels = null; // cross-origin without CORS
}
};
// Per-cell ink coverage 0..1 (1 = full ink). Honors invert.
const inkAt = (i: number) => {
if (!pixels) return 0;
const r = pixels[i] as number;
const g = pixels[i + 1] as number;
const b = pixels[i + 2] as number;
const a = (pixels[i + 3] as number) / 255;
const luma = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
let ink = invert ? luma : 1 - luma;
// Stretch around mid-gray so faces/features separate instead of muddying.
if (contrast !== 1) ink = clamp01((ink - 0.5) * contrast + 0.5);
return ink * a;
};
const inkStyle = (i: number) => {
if (color === "source" && pixels) {
return `rgb(${pixels[i]},${pixels[i + 1]},${pixels[i + 2]})`;
}
if (usesTheme) {
const [r, g, b] = fgRef.current;
return `rgb(${r},${g},${b})`;
}
return color as string;
};
// Floyd–Steinberg error diffusion → quantized level grid (0..1).
const diffuse = () => {
const buf = new Float32Array(cols * rows);
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
buf[y * cols + x] = inkAt((y * cols + x) * 4);
}
}
const step = 1 / (normalizedLevels - 1);
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
const idx = y * cols + x;
const oldV = buf[idx] as number;
const q = Math.round(oldV / step) * step;
buf[idx] = q;
const err = oldV - q;
if (x + 1 < cols) buf[idx + 1] += (err * 7) / 16;
if (y + 1 < rows) {
if (x > 0) buf[idx + cols - 1] += (err * 3) / 16;
buf[idx + cols] += (err * 5) / 16;
if (x + 1 < cols) buf[idx + cols + 1] += (err * 1) / 16;
}
}
}
return buf;
};
const render = (time: number) => {
ctx.clearRect(0, 0, w, h);
if (background !== "transparent") {
ctx.fillStyle = background;
ctx.fillRect(0, 0, w, h);
}
if (!ready || !pixels) return;
const revealMs = 700;
const revealP =
reveal && !reduced.matches && revealStart
? clamp01((time - revealStart) / revealMs)
: 1;
const ptr = pointerRef.current;
const diffused =
variant === "dither" && ditherType === "floyd-steinberg"
? diffuse()
: null;
const lvlStep = 1 / (normalizedLevels - 1);
if (variant === "ascii") {
ctx.font = `${Math.ceil(cellH * 1.05)}px ${fontFamily}`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
}
const maxLen = charset.length - 1;
for (let cy = 0; cy < rows; cy++) {
for (let cx = 0; cx < cols; cx++) {
const i = (cy * cols + cx) * 4;
const ink = inkAt(i);
// Reveal wipe from the center outward.
let alpha = 1;
if (revealP < 1) {
const dx = cx / cols - 0.5;
const dy = cy / rows - 0.5;
const dist = Math.hypot(dx, dy) / 0.72;
alpha = clamp01((revealP * 1.35 - dist) / 0.25);
if (alpha <= 0) continue;
}
// Pointer focus-lens.
let ox = 0;
if (interactive && ptr.active) {
const px = cx * cellW + cellW / 2;
const py = cy * cellH + cellH / 2;
const focus = clamp01(
1 - Math.hypot(px - ptr.x, py - ptr.y) / lensRadius,
);
alpha *= 0.25 + 0.75 * easeInOut(focus);
}
// Ambient glitch — offset and scramble a few rows.
let charIndex = -1;
if (glitch && !reduced.matches) {
const rowSeed = Math.sin(cy * 12.9898 + scramble) * 43758.5453;
const rowActive = rowSeed - Math.floor(rowSeed) > 0.86;
if (rowActive) {
ox = ((Math.floor(rowSeed * 7) % 5) - 2) * cellW;
if ((cx + Math.floor(scramble)) % 3 === 0) {
const s = Math.abs(Math.sin(cx * 78.233 + scramble * 3.1));
charIndex = Math.floor(s * maxLen);
}
}
}
if (variant === "ascii") {
if (ink <= 0.001 && charIndex < 0) continue;
const idx = charIndex >= 0 ? charIndex : Math.round(ink * maxLen);
const ch = charset[idx] ?? " ";
if (ch === " ") continue;
ctx.globalAlpha = alpha;
ctx.fillStyle = inkStyle(i);
ctx.fillText(
ch,
cx * cellW + cellW / 2 + ox,
cy * cellH + cellH / 2,
);
} else {
const level =
diffused != null
? (diffused[cy * cols + cx] as number)
: (() => {
const t = BAYER[cy % 4]?.[cx % 4] ?? 0.5;
const v = ink + (t - 0.5) / normalizedLevels;
return clamp01(Math.round(v / lvlStep) * lvlStep);
})();
if (level <= 0) continue;
const size = level * Math.min(cellW, cellH);
const dxp = cx * cellW + (cellW - size) / 2 + ox;
const dyp = cy * cellH + (cellH - size) / 2;
ctx.globalAlpha = alpha;
ctx.fillStyle = inkStyle(i);
if (dotShape === "circle") {
ctx.beginPath();
ctx.arc(
dxp + size / 2,
dyp + size / 2,
size / 2,
0,
Math.PI * 2,
);
ctx.fill();
} else {
ctx.fillRect(dxp, dyp, size, size);
}
}
}
}
ctx.globalAlpha = 1;
};
const tick = (time: number) => {
if (time - last >= frameGap()) {
last = time;
if (isVideo) sample();
if (glitch) scramble += 0.6;
render(time);
} else {
render(time);
}
// Keep looping while there's motion, or to finish the reveal.
const revealing =
reveal &&
!reduced.matches &&
revealStart > 0 &&
time - revealStart < 700;
if (needsLoop() || revealing) {
rafId = requestAnimationFrame(tick);
} else {
rafId = 0;
}
};
const start = () => {
if (rafId) return;
rafId = requestAnimationFrame(tick);
};
const stop = () => {
if (rafId) cancelAnimationFrame(rafId);
rafId = 0;
};
const syncLoop = () => {
const revealing =
reveal &&
!reduced.matches &&
revealStart > 0 &&
performance.now() - revealStart < 700;
if (visible && (needsLoop() || revealing)) start();
else stop();
};
const onVideoPlay = () => syncLoop();
const onVideoPause = () => syncLoop();
const onVideoEnded = () => {
if (cancelled) return;
// Sample and paint the terminal frame before syncing the loop state.
sample();
render(performance.now());
syncLoop();
};
const kickoff = () => {
if (cancelled) return;
ready = true;
measure();
sample();
if (reveal && !reduced.matches) {
revealStart = performance.now();
}
// Static image with no ongoing motion: draw once, no rAF.
if (needsLoop() || (reveal && !reduced.matches)) start();
else render(performance.now());
};
// Load the source.
if (isVideo) {
const video = document.createElement("video");
video.crossOrigin = "anonymous";
video.muted = muted;
video.loop = loop;
video.playsInline = true;
video.preload = "auto";
source = video;
video.addEventListener("play", onVideoPlay);
video.addEventListener("pause", onVideoPause);
video.addEventListener("ended", onVideoEnded);
const onReady = () => {
if (reduced.matches || !autoPlay) {
video.currentTime = 0.001;
} else {
video.play().catch(() => {});
}
kickoff();
};
video.addEventListener("loadeddata", onReady, { once: true });
video.src = src;
} else {
const img = new Image();
img.crossOrigin = "anonymous";
img.onload = kickoff;
img.onerror = () => {
if (cancelled) return;
ready = true;
render(performance.now());
};
source = img;
img.src = src;
}
// Observers.
const resizeObserver = new ResizeObserver(() => {
if (!ready) return;
measure();
sample();
if (rafId) return;
render(performance.now());
});
resizeObserver.observe(container);
// A portaled preview can live in a different window (the docs mobile
// preview uses an iframe). IntersectionObserver is scoped to the window
// that creates it, so use the container's realm instead of the module's
// parent window; otherwise the iframe canvas is reported as not visible.
const view = container.ownerDocument.defaultView ?? window;
const intersectionObserver =
"IntersectionObserver" in view
? new view.IntersectionObserver(
([entry]) => {
visible = !!entry?.isIntersecting;
if (!visible) stop();
else if (needsLoop()) start();
else if (ready) render(performance.now());
},
{ threshold: 0 },
)
: undefined;
intersectionObserver?.observe(container);
const onVisibility = () => {
if (document.hidden) stop();
else if (visible && needsLoop()) start();
};
document.addEventListener("visibilitychange", onVisibility);
const onPointerMove = (e: PointerEvent) => {
if (!interactive) return;
const rect = container.getBoundingClientRect();
pointerRef.current = {
x: e.clientX - rect.left,
y: e.clientY - rect.top,
active: true,
};
if (visible) start();
};
const onPointerLeave = () => {
pointerRef.current.active = false;
};
if (interactive) {
container.addEventListener("pointermove", onPointerMove);
container.addEventListener("pointerleave", onPointerLeave);
}
return () => {
cancelled = true;
stop();
resizeObserver.disconnect();
intersectionObserver?.disconnect();
document.removeEventListener("visibilitychange", onVisibility);
container.removeEventListener("pointermove", onPointerMove);
container.removeEventListener("pointerleave", onPointerLeave);
if (source instanceof HTMLVideoElement) {
source.removeEventListener("play", onVideoPlay);
source.removeEventListener("pause", onVideoPause);
source.removeEventListener("ended", onVideoEnded);
source.pause();
source.removeAttribute("src");
source.load();
} else if (source) {
source.onload = null;
source.onerror = null;
source.src = "";
}
};
}, [
src,
isVideo,
variant,
safeCellSize,
charset,
fontFamily,
ditherType,
normalizedLevels,
dotShape,
color,
usesTheme,
background,
invert,
contrast,
reveal,
interactive,
glitch,
lensRadius,
autoPlay,
loop,
muted,
fps,
]);
return (
<div
ref={containerRef}
data-slot="ascii-dither"
role="img"
aria-label={alt}
className={`relative size-full overflow-hidden ${className ?? ""}`}
style={{ ...style, touchAction: interactive ? "none" : undefined }}
{...props}
>
<canvas
ref={canvasRef}
className={
interactive ? "size-full" : "pointer-events-none size-full"
}
/>
</div>
);
},
);
AsciiDither.displayName = "AsciiDither";
export { AsciiDither };
// ── ascii-dither/index.ts (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/ascii-dither/index.ts)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
export {
AsciiDither,
type AsciiDitherColor,
type AsciiDitherProps,
type AsciiDitherVariant,
} from "./ascii-dither";
// ── cn.ts (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/cn.ts)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...a){ return twMerge(clsx(a)); }
// ── demos/_kit.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/demos/_kit.tsx)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
"use client";
import { forwardRef, type ReactNode } from "react";
import { cn } from "../cn";
type MaxWidth = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "none";
const maxWidthClass: Record<MaxWidth, string> = {
sm: "max-w-sm",
md: "max-w-md",
lg: "max-w-lg",
xl: "max-w-xl",
"2xl": "max-w-2xl",
"3xl": "max-w-3xl",
none: "",
};
/**
* Center a compact demo in the stage. Use with the default (non-fullWidth)
* Example layout — buttons, inputs, cards, small widgets.
*/
export function DemoCenter({
children,
className,
max = "none",
}: {
children: ReactNode;
className?: string;
/** Optional max-width on the centering shell. */
max?: MaxWidth;
}) {
return (
<div
className={cn(
"mx-auto flex w-full items-center justify-center",
maxWidthClass[max],
className,
)}
>
{children}
</div>
);
}
type MediaAspect = "square" | "video" | "photo" | "portrait" | "wide";
const aspectClass: Record<MediaAspect, string> = {
square: "aspect-square",
video: "aspect-video",
photo: "aspect-[4/3]",
portrait: "aspect-[3/4]",
wide: "aspect-[5/2]",
};
/**
* Media / image demos — one width + aspect language across compare, accordion,
* galleries, and tilt/holo cards. Stays centered (no Example fullWidth).
*/
export function DemoMedia({
children,
className,
max = "md",
aspect,
}: {
children: ReactNode;
className?: string;
max?: Exclude<MaxWidth, "none">;
aspect?: MediaAspect;
}) {
return (
<div
className={cn(
"mx-auto w-full",
maxWidthClass[max],
aspect ? aspectClass[aspect] : null,
className,
)}
>
{children}
</div>
);
}
type ScrollPortVariant = "fill" | "framed";
type DemoScrollPortProps = {
children: ReactNode;
className?: string;
/**
* `fill` — fills the stage (pair with Example `fullWidth`).
* `framed` — fixed-height bordered card, centered (no `fullWidth`).
*/
variant?: ScrollPortVariant;
/** Height for the framed variant (CSS length). Default `26rem`. */
height?: string;
/** Max width for the framed variant. Default `md`. */
max?: Exclude<MaxWidth, "none">;
/** Sticky cue at the top of the port (e.g. "Scroll to reveal"). */
hint?: string;
};
/**
* Scroll viewport for scroll-driven demos. Forward the ref into the component's
* `scrollContainer` / `container` prop so the preview stage (not the window)
* drives the scrub.
*/
function ScrollHint({ hint }: { hint: string }) {
return (
<div className="sticky top-0 z-10 flex justify-center bg-gradient-to-b from-card/90 to-transparent py-3">
<span className="rounded-full border border-border/60 bg-card/80 px-2.5 py-1 font-medium text-[11px] text-muted-foreground backdrop-blur-sm">
{hint}
</span>
</div>
);
}
export const DemoScrollPort = forwardRef<HTMLDivElement, DemoScrollPortProps>(
function DemoScrollPort(
{
children,
className,
variant = "fill",
height = "26rem",
max = "md",
hint,
},
ref,
) {
if (variant === "framed") {
return (
<div
ref={ref}
data-scroll-container
className={cn(
"relative mx-auto w-full overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-card/40 [scrollbar-width:thin]",
maxWidthClass[max],
className,
)}
style={{ height }}
>
{hint ? <ScrollHint hint={hint} /> : null}
{children}
</div>
);
}
return (
<div
ref={ref}
data-scroll-container
className={cn(
"relative h-full min-h-0 w-full overflow-x-hidden overflow-y-auto",
className,
)}
>
{hint ? <ScrollHint hint={hint} /> : null}
{children}
</div>
);
},
);
/**
* Vertical runway inside a scroll port so scrubbing demos have distance to
* travel before / after the focal content.
*/
export function DemoScrollRunway({
children,
className,
pad = "lg",
}: {
children: ReactNode;
className?: string;
pad?: "md" | "lg" | "xl";
}) {
const padClass = {
md: "py-[22vh]",
lg: "py-[40vh]",
xl: "py-[55vh]",
}[pad];
return (
<div className={cn("mx-auto w-full", padClass, className)}>{children}</div>
);
}
/**
* Full-bleed scene that fills the stage. Pair with Example `fullWidth` —
* backgrounds, docks, pointer playgrounds, glass surfaces.
*/
export function DemoScene({
children,
className,
}: {
children: ReactNode;
className?: string;
}) {
return (
<div
className={cn(
"relative flex h-full min-h-0 w-full flex-1 flex-col",
className,
)}
>
{children}
</div>
);
}
// ── demos/ascii-dither-demo.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/demos/ascii-dither-demo.tsx)
"use client";
import { AsciiDither } from "@godui/lab";
import { DemoMedia } from "@/components/demos/_kit";
const PORTRAIT =
"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=512&h=640&fit=crop&q=80";
const VIDEO =
"https://videos.pexels.com/video-files/1409899/1409899-sd_640_360_25fps.mp4";
function Cell({
children,
caption,
ratio = "portrait",
stack = false,
}: {
children: React.ReactNode;
caption: string;
ratio?: "portrait" | "video";
stack?: boolean;
}) {
const size =
ratio === "video"
? stack
? "aspect-video max-w-[38rem]"
: "aspect-video max-w-[22rem]"
: "aspect-[4/5] max-w-[16rem]";
return (
<figure className="flex w-full min-w-0 flex-1 flex-col items-center gap-2">
<div
className={`mx-auto w-full overflow-hidden rounded-xl border border-border bg-card ${size}`}
>
{children}
</div>
<figcaption className="font-mono text-muted-foreground text-xs">
{caption}
</figcaption>
</figure>
);
}
function Compare({
original,
rendered,
label,
ratio,
stack = false,
}: {
original: React.ReactNode;
rendered: React.ReactNode;
label: string;
ratio?: "portrait" | "video";
stack?: boolean;
}) {
return (
<DemoMedia max={stack ? "3xl" : "2xl"}>
<div
className={`flex items-center justify-center gap-4 ${stack ? "flex-col" : "flex-wrap sm:flex-nowrap"}`}
>
<Cell caption="original" ratio={ratio} stack={stack}>
{original}
</Cell>
<span
aria-hidden="true"
className={`shrink-0 text-2xl text-muted-foreground ${stack ? "block rotate-90" : "hidden sm:block"}`}
>
→
</span>
<Cell caption={label} ratio={ratio} stack={stack}>
{rendered}
</Cell>
</div>
</DemoMedia>
);
}
export function AsciiDitherDemo() {
return (
<Compare
label="ascii"
original={
<img
src={PORTRAIT}
alt="Original headphones"
className="size-full object-cover"
/>
}
rendered={
<AsciiDither
src={PORTRAIT}
alt="Headphones rendered as ASCII characters"
variant="ascii"
cellSize={4}
contrast={1.4}
color="theme"
interactive
reveal
/>
}
/>
);
}
export function AsciiDitherDitherDemo() {
return (
<Compare
label="dither"
original={
<img
src={PORTRAIT}
alt="Original headphones"
className="size-full object-cover"
/>
}
rendered={
<AsciiDither
src={PORTRAIT}
alt="Headphones rendered as halftone dither dots"
variant="dither"
dotShape="circle"
cellSize={4}
contrast={1.3}
color="theme"
reveal
/>
}
/>
);
}
export function AsciiDitherVideoDemo() {
return (
<Compare
label="ascii"
ratio="video"
stack
original={
<video
src={VIDEO}
className="size-full object-cover"
autoPlay
loop
muted
playsInline
/>
}
rendered={
<AsciiDither
src={VIDEO}
alt="Ocean waves rendered as ASCII"
type="video"
cellSize={5}
contrast={1.35}
color="theme"
reveal={false}
/>
}
/>
);
}
export function AsciiDitherGlitchDemo() {
return (
<Compare
label="glitch"
original={
<img
src={PORTRAIT}
alt="Original headphones"
className="size-full object-cover"
/>
}
rendered={
<AsciiDither
src={PORTRAIT}
alt="Headphones rendered as ASCII with ambient glitch"
variant="ascii"
cellSize={4}
contrast={1.4}
color="theme"
glitch
reveal={false}
/>
}
/>
);
}Kawalan · HTML · CSS · JS
Sunting kod dan laraskan dengan kawalan. Pratonton dikemas kini semasa anda menaip.

Komponen ini berjalan daripada binaan berpakej, jadi skripnya baca sahaja di sini. Sunting HTML dan CSS; sumber penuh ada dalam tab Kod.
Sunting setiap komponen secara langsung, laraskan dengan kawalan, muat turun sumber penuh dan salin prompt lanjutan.
$49 sekali bayarHarga sementara
Mod ujian: tiada bayaran sebenar dikenakan.
Percuma: pratonton, butang salin dan nota pelajaran.
Satu kesan kuat dalam susun atur yang tenang.
Bahagian hero dan detik istimewa.
Ubah kelajuan, warna dan keamatan.
Tambahkan komponen "ASCII Dither" daripada GodUI (github.com/LucasBassetti/godui) (MIT) ke aplikasi React + Tailwind CSS saya. Fail sumber: https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/packages/lab/src/ascii-dither. Satu kesan kuat dalam susun atur yang tenang. Gunakan untuk: Bahagian hero dan detik istimewa. Tetapan untuk dilaras: Ubah kelajuan, warna dan keamatan. Sokong tema cerah dan gelap serta hormati prefers-reduced-motion. Kekalkan notis lesen MIT.
Prompt lebih panjang dengan langkah pelarasan, kebolehcapaian dan integrasi.