Eduardo Calvo

Shader Tint

Shaders

About

A dock of tiles lit from behind by a WebGL glow that travels to the active tile and blends into its three-colour palette; arrow keys move it. Respects prefers-reduced-motion.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Shader Tint to your project and fits it to your theme.

Code

How Shader Tint is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { Feather, Flame, Leaf, Waves } from "lucide-react";
import { useEffect, useState } from "react";
import Component, { type ShaderTintItem } from "@/components/ui/shader-tint";

const ITEMS: ShaderTintItem[] = [
  {
    id: "ember",
    label: "Ember",
    mark: <Flame aria-hidden className="size-6 text-foreground" />,
    palette: ["#ff7a59", "#ff4fa3", "#8b5cf6"],
  },
  {
    id: "tide",
    label: "Tide",
    mark: <Waves aria-hidden className="size-6 text-foreground" />,
    palette: ["#335cff", "#3fb6ff", "#7c5cff"],
  },
  {
    id: "grove",
    label: "Grove",
    mark: <Leaf aria-hidden className="size-6 text-foreground" />,
    palette: ["#2fd5a0", "#9be15d", "#3aa0ff"],
  },
  {
    id: "dune",
    label: "Dune",
    mark: <Feather aria-hidden className="size-6 text-foreground" />,
    palette: ["#ffb020", "#ff5a36", "#e0368a"],
  },
];

// The shader blends differently on light and dark surfaces, so follow the page theme.
function useIsDark() {
  const [dark, setDark] = useState(false);
  useEffect(() => {
    const root = document.documentElement;
    const read = () => setDark(root.classList.contains("dark"));
    read();
    const observer = new MutationObserver(read);
    observer.observe(root, { attributeFilter: ["class"], attributes: true });
    return () => observer.disconnect();
  }, []);
  return dark;
}

export default function DemoOne() {
  const dark = useIsDark();
  const [active, setActive] = useState("ember");

  // Walk the palette so the cover catches the light moving between tiles.
  useEffect(() => {
    const id = setInterval(() => {
      setActive((current) => {
        const index = ITEMS.findIndex((item) => item.id === current);
        return ITEMS[(index + 1) % ITEMS.length].id;
      });
    }, 1800);
    return () => clearInterval(id);
  }, []);

  return (
    <div className="flex min-h-[520px] w-full items-center justify-center bg-background p-10">
      <div className="origin-center scale-[2.6]">
        <Component
          activeId={active}
          dark={dark}
          items={ITEMS}
          label="Accent"
          onActiveChange={setActive}
        />
      </div>
    </div>
  );
}

Dependencies

More by Eduardo Calvo

View all
  • Scrollable Card Stack

    Scrollable Card Stack

    301
  • Pixel Flow Field

    Pixel Flow Field

    222
  • Siri Orb

    Siri Orb

    204
  • AI Task List

    AI Task List

    203
  • Gravity Stars

    Gravity Stars

    186
  • Cursor Follow

    Cursor Follow

    164
  • Coverflow Carousel

    Coverflow Carousel

    161
  • Agent Avatar

    Agent Avatar

    161

More in Shaders

View all
  • Shader Animation

    Shader Animation

    3.9K
  • Glass Fold

    Glass Fold

    599
  • Black Hole

    Black Hole

    56
  • Illos Knowledge Sources

    Illos Knowledge Sources

    77
  • DitheredShaderBackground

    DitheredShaderBackground

    59
  • LightSpeed

    LightSpeed

    254
  • Chroma Sense Hero

    Chroma Sense Hero

    23
  • Stream Search

    Stream Search

    88