@madebywild/sanity-color-field
v3.0.1
Published
> [!IMPORTANT] > This package is primarily intended for internal use.
Readme
[!IMPORTANT] This package is primarily intended for internal use.
@madebywild/sanity-color-field
Sanity field type for curated color selection with optional filtering.
Install
pnpm add @madebywild/sanity-color-fieldConfigure Plugin
import { defineConfig } from "sanity";
import { wildSanityColorFieldPlugin } from "@madebywild/sanity-color-field";
export default defineConfig({
plugins: [
wildSanityColorFieldPlugin({
colorList: [
{ label: "Brand Red", value: "#d92d20" },
{ label: "Brand Blue", value: "#175cd3" },
{ label: "Neutral", value: "#667085" },
],
renderValue: (value) => <span style={{ backgroundColor: value, width: 16, height: 16, borderRadius: 999 }} />,
}),
],
});Use in Schema
import { defineField } from "sanity";
defineField({
name: "themeColor",
type: "wild.color",
options: {
whitelist: ["#d92d20", "#175cd3"],
blacklist: ["#667085"],
},
});