Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

11.3 KB
Raw Blame
import scrollbar from "tailwind-scrollbar";
import type { Config } from "tailwindcss";
import plugin from "tailwindcss/plugin";
import tailwindcssAnimate from "tailwindcss-animate";
import { colors } from "./src/components/styles/colors";

const SMOOTH_SHADOW_SM =
  "0 18px 47px 0 color-mix(in srgb, var(--smooth-shadow-color) 3%, transparent), 0 7.5px 19px 0 color-mix(in srgb, var(--smooth-shadow-color) 2%, transparent), 0 4px 10.5px 0 color-mix(in srgb, var(--smooth-shadow-color) 2%, transparent), 0 2.3px 5.8px 0 color-mix(in srgb, var(--smooth-shadow-color) 1%, transparent), 0 1.2px 3.1px 0 color-mix(in srgb, var(--smooth-shadow-color) 1%, transparent), 0 0.5px 1.3px 0 color-mix(in srgb, var(--smooth-shadow-color) 1%, transparent)";
const SMOOTH_RING =
  "0 0 0 var(--smooth-ring-width, 1px) var(--smooth-ring-color)";

const smoothShadowRing = plugin(function smoothShadowRing({
  addBase,
  addUtilities,
}) {
  addBase({
    ":root": {
      "--smooth-ring-color": "rgba(0, 0, 0, 0.05)",
      "--smooth-ring-width": "1px",
    },
    '.dark, .dark-mode, [data-theme="dark"]': {
      "--smooth-ring-color": "rgba(255, 255, 255, 0.18)",
    },
  });
  addUtilities({
    ".smooth-shadow-ring-sm": {
      "--smooth-shadow-color": "var(--tw-shadow-color, rgb(0 0 0))",
      boxShadow: `${SMOOTH_SHADOW_SM}, ${SMOOTH_RING}`,
    },
  });
});

// Fractal-noise tile, inlined so the grain costs no extra request. `#` and `%`
// stay percent-encoded or the data URI terminates early.
const GRAIN_TEXTURE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E")`;

// Lays grain over an element's own background. Deliberately sets no `position`,
// so it never fights the positioning utilities already on the target — callers
// must position the element themselves.
const grainTexture = plugin(function grainTexture({ addUtilities }) {
  addUtilities({
    ".grain-overlay::after": {
      content: '""',
      position: "absolute",
      inset: "0",
      backgroundImage: GRAIN_TEXTURE,
      opacity: "0.5",
      mixBlendMode: "soft-light",
      pointerEvents: "none",
    },
  });
});

const textShadow = plugin(function textShadow({ matchUtilities, theme }) {
  matchUtilities(
    {
      "text-shadow": (value) => ({ textShadow: value }),
    },
    { values: theme("textShadow") },
  );
});

const config = {
  darkMode: ["class", ".dark-mode"], // ignore dark: prefix classes for now until we fully support dark mode
  content: ["./src/**/*.{ts,tsx}", "./node_modules/streamdown/dist/**/*.js"],
  prefix: "",
  theme: {
    container: {
      center: true,
      padding: "2rem",
      screens: {
        "2xl": "1400px",
      },
    },
    extend: {
      fontFamily: {
        sans: ["var(--font-geist-sans)"],
        mono: ["var(--font-geist-mono)"],
        poppins: ["var(--font-poppins)"],
      },
      colors: {
        ...colors,
        border: "hsl(var(--border))",
        input: "hsl(var(--input))",
        ring: "hsl(var(--ring))",
        background: "hsl(var(--background))",
        foreground: "hsl(var(--foreground))",
        primary: {
          DEFAULT: "hsl(var(--primary))",
          foreground: "hsl(var(--primary-foreground))",
        },
        secondary: {
          DEFAULT: "hsl(var(--secondary))",
          foreground: "hsl(var(--secondary-foreground))",
        },
        destructive: {
          DEFAULT: "hsl(var(--destructive))",
          foreground: "hsl(var(--destructive-foreground))",
        },
        muted: {
          DEFAULT: "hsl(var(--muted))",
          foreground: "hsl(var(--muted-foreground))",
        },
        accent: {
          DEFAULT: "hsl(var(--accent))",
          foreground: "hsl(var(--accent-foreground))",
        },
        popover: {
          DEFAULT: "hsl(var(--popover))",
          foreground: "hsl(var(--popover-foreground))",
        },
        card: {
          DEFAULT: "hsl(var(--card))",
          foreground: "hsl(var(--card-foreground))",
        },
        customGray: {
          "100": "#d9d9d9",
          "200": "#a8a8a8",
          "300": "#878787",
          "400": "#646464",
          "500": "#474747",
          "600": "#282828",
          "700": "#272727",
        },
        sidebar: {
          DEFAULT: "hsl(var(--sidebar-background))",
          foreground: "hsl(var(--sidebar-foreground))",
          primary: "hsl(var(--sidebar-primary))",
          "primary-foreground": "hsl(var(--sidebar-primary-foreground))",
          accent: "hsl(var(--sidebar-accent))",
          "accent-foreground": "hsl(var(--sidebar-accent-foreground))",
          border: "hsl(var(--sidebar-border))",
          ring: "hsl(var(--sidebar-ring))",
        },
      },
      spacing: {
        "0": "0rem",
        "1": "0.25rem",
        "2": "0.5rem",
        "3": "0.75rem",
        "4": "1rem",
        "5": "1.25rem",
        "6": "1.5rem",
        "7": "1.75rem",
        "8": "2rem",
        "9": "2.25rem",
        "10": "2.5rem",
        "11": "2.75rem",
        "12": "3rem",
        "14": "3.5rem",
        "16": "4rem",
        "18": "4.5rem",
        "20": "5rem",
        "24": "6rem",
        "28": "7rem",
        "32": "8rem",
        "36": "9rem",
        "40": "10rem",
        "44": "11rem",
        "48": "12rem",
        "52": "13rem",
        "56": "14rem",
        "60": "15rem",
        "64": "16rem",
        "68": "17rem",
        "70": "17.5rem",
        "71": "17.75rem",
        "72": "18rem",
        "76": "19rem",
        "80": "20rem",
        "96": "24rem",
        "0.5": "0.125rem",
        "1.5": "0.375rem",
        "2.5": "0.625rem",
        "3.5": "0.875rem",
        "4.5": "1.125rem",
        "7.5": "1.875rem",
        "8.5": "2.125rem",
      },
      borderRadius: {
        xsmall: "0.25rem",
        small: "0.5rem",
        medium: "0.75rem",
        large: "1rem",
        xlarge: "1.25rem",
        "2xlarge": "1.5rem",
        full: "9999px",
        lg: "var(--radius)",
        md: "calc(var(--radius) - 2px)",
        sm: "calc(var(--radius) - 4px)",
      },
      boxShadow: {
        subtle: "0px 1px 2px 0px rgba(0,0,0,0.05)",
        "message-table": "0 1px 2px rgba(0,0,0,0.04)",
      },
      backgroundImage: {
        "message-table-header":
          "radial-gradient(35% 160% at 8% 0%, rgba(139,92,246,0.05), transparent), radial-gradient(35% 160% at 50% 0%, rgba(99,102,241,0.04), transparent), radial-gradient(35% 160% at 92% 0%, rgba(59,130,246,0.05), transparent), linear-gradient(to bottom, theme(colors.white), theme(colors.zinc.50))",
      },
      textShadow: {
        "message-table-violet":
          "0 0 6px rgba(139,92,246,0.45), 0 0 18px rgba(139,92,246,0.55)",
        "message-table-indigo":
          "0 0 6px rgba(99,102,241,0.45), 0 0 18px rgba(99,102,241,0.55)",
        "message-table-blue":
          "0 0 6px rgba(59,130,246,0.45), 0 0 18px rgba(59,130,246,0.55)",
      },
      keyframes: {
        "accordion-down": {
          from: {
            height: "0",
          },
          to: {
            height: "var(--radix-accordion-content-height)",
          },
        },
        "accordion-up": {
          from: {
            height: "var(--radix-accordion-content-height)",
          },
          to: {
            height: "0",
          },
        },
        // Bridge the height change with an opacity fade so the content
        // doesn't clip in/out abruptly (Emil Kowalski: fade to soften
        // state transitions). Opacity resolves over the first/last ~60%
        // so text is fully legible before the height finishes settling.
        "collapsible-down": {
          from: {
            height: "0",
            opacity: "0",
          },
          "60%": {
            opacity: "1",
          },
          to: {
            height: "var(--radix-collapsible-content-height)",
            opacity: "1",
          },
        },
        "collapsible-up": {
          from: {
            height: "var(--radix-collapsible-content-height)",
            opacity: "1",
          },
          "40%": {
            opacity: "0",
          },
          to: {
            height: "0",
            opacity: "0",
          },
        },
        "fade-in": {
          "0%": {
            opacity: "0",
          },
          "100%": {
            opacity: "1",
          },
        },
        shimmer: {
          "0%": {
            backgroundPosition: "200% 0",
          },
          "100%": {
            backgroundPosition: "-200% 0",
          },
        },
        loader: {
          "0%": {
            boxShadow: "0 0 0 0 rgba(0, 0, 0, 0.25)",
          },
          "100%": {
            boxShadow: "0 0 0 30px rgba(0, 0, 0, 0)",
          },
        },
        shake: {
          "0%, 100%": { transform: "translateX(0)" },
          "20%": { transform: "translateX(-4px)" },
          "40%": { transform: "translateX(4px)" },
          "60%": { transform: "translateX(-3px)" },
          "80%": { transform: "translateX(3px)" },
        },
        "marquee-x": {
          "0%": { transform: "translateX(0)" },
          "100%": { transform: "translateX(-50%)" },
        },
        "progress-bar": {
          "0%": { transform: "translateX(-100%)" },
          "100%": { transform: "translateX(400%)" },
        },
        "caret-blink": {
          "0%, 100%": { opacity: "1" },
          "50%": { opacity: "0" },
        },
        "shimmer-text": {
          "0%": { backgroundPosition: "100% 0" },
          "100%": { backgroundPosition: "0% 0" },
        },
        "fade-up": {
          from: { opacity: "0", transform: "translateY(6px)" },
          to: { opacity: "1", transform: "translateY(0)" },
        },
        "grow-line": {
          from: { transform: "scaleY(0)" },
          to: { transform: "scaleY(1)" },
        },
      },
      animation: {
        "accordion-down": "accordion-down 0.2s ease-out",
        "accordion-up": "accordion-up 0.2s ease-out",
        // easeOutCubic for a smooth, decelerating settle; asymmetric
        // timing (open a touch slower than close) per Emil Kowalski.
        // Both stay under the 300ms UI budget.
        "collapsible-down":
          "collapsible-down 0.26s cubic-bezier(0.33, 1, 0.68, 1)",
        "collapsible-up": "collapsible-up 0.2s cubic-bezier(0.33, 1, 0.68, 1)",
        "fade-in": "fade-in 0.2s ease-out",
        shimmer: "shimmer 4s ease-in-out infinite",
        loader: "loader 1s infinite",
        shake: "shake 0.5s ease-in-out",
        "marquee-x": "marquee-x 40s linear infinite",
        "progress-bar":
          "progress-bar 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite",
        "caret-blink": "caret-blink 1s step-end infinite",
        "shimmer-text": "shimmer-text 2s linear infinite",
        "fade-up": "fade-up 320ms cubic-bezier(0.23, 1, 0.32, 1) both",
        "grow-line": "grow-line 500ms cubic-bezier(0.23, 1, 0.32, 1) both",
      },
      transitionDuration: {
        "400": "400ms",
        "2000": "2000ms",
      },
      transitionTimingFunction: {
        // easeOutQuint — long, soft settle for accordion expand/collapse.
        "out-quint": "cubic-bezier(0.23, 1, 0.32, 1)",
      },
    },
  },
  plugins: [
    tailwindcssAnimate,
    scrollbar({ nocompatible: true }),
    smoothShadowRing,
    grainTexture,
    textShadow,
  ],
} satisfies Config;

export default config;