import React, { type FC } from "react"; import { wrapFieldsWithMeta } from "tinacms"; // Theme definitions with their color palettes const themes = [ { value: "default", label: "Default", description: "Clean monochrome design", colors: { primary: "#0f172a", secondary: "#64748b", accent: "#e2e8f0", }, }, { value: "tina", label: "Tina", description: "TinaCMS-inspired orange & blue", colors: { primary: "#EC4815", secondary: "#0084FF", accent: "#93E9BE", }, }, { value: "blossom", label: "Blossom", description: "Elegant pink & rose tones", colors: { primary: "#e54666", secondary: "#dc3b5d", accent: "#ffcdcf", }, }, { value: "lake", label: "Lake", description: "Professional blue palette", colors: { primary: "#0090FF", secondary: "#3b82f6", accent: "#bfdbfe", }, }, { value: "pine", label: "Pine", description: "Natural green tones", colors: { primary: "#30A46C", secondary: "#5bb98c", accent: "#c4e8d1", }, }, { value: "indigo", label: "Indigo", description: "Modern purple & violet", colors: { primary: "#6E56CF", secondary: "#b197fc", accent: "#e1d9ff", }, }, ]; interface ThemeOptionProps { theme: { value: string; label: string; description: string; colors: { primary: string; secondary: string; accent: string; }; }; isSelected: boolean; onClick: () => void; } const ThemeOption: FC = ({ theme, isSelected, onClick }) => { return (
{/* Color palette preview */}
{/* Theme info */}
{theme.label}
{theme.description}
{/* Selection indicator */} {isSelected && (
)}
); }; export const ThemeSelector = wrapFieldsWithMeta(({ input, field }) => { const currentValue = input.value || "default"; const handleThemeChange = (themeValue: string) => { input.onChange(themeValue); }; return (
{themes.map((theme, index) => ( handleThemeChange(theme.value)} /> ))}
{/* Current selection display */}
Current theme:{" "} {themes.find((t) => t.value === currentValue)?.label || currentValue}
{/* Instructions for custom themes */}

Want to create a custom theme?

You can create your own custom themes by modifying the CSS variables in the global stylesheet. See the{" "} Custom Theming section in the README {" "} for detailed instructions on how to create new themes.

Files to modify:{" "} src/styles/global.css , tina/customFields/theme-selector.tsx , and src/components/ui/theme-selector.tsx
); });