Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Statamic Color Swatches Laravel Package

rias/statamic-color-swatches

Statamic Color Swatches adds a configurable color picker fieldtype for the Statamic control panel, letting editors choose from predefined swatches and palettes instead of typing hex values. Keep brand colors consistent across entries and simplify content editing.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Implements the native Statamic addon contract cleanly: AddonServiceProvider subclass, fieldtype registered via the $fieldtypes property, assets declared through the $vite property. No bespoke bootstrapping or Laravel service-provider gymnastics to audit.
  • Correctly scoped as a single-purpose CP input widget, not a color-management or design-token system. It renders swatch buttons and stores { label, value[] }. Nothing more.
  • Hard coupling to Statamic v6 and PHP 8+. The Vue 2 Options API components, the @statamic/components/fieldtypes mixins, and the Statamic Vite plugin all assume the v6 CP runtime. This is not usable in a plain Laravel app or an older Statamic install.
  • dist/ is committed, so consumers need no Node toolchain. That is a genuine operational convenience for locked-down CI pipelines, at the cost of possible source/build drift.

Integration feasibility

  • Low friction: composer require, addon registration per Statamic v6 conventions, then reference color_swatches in a blueprint. No migrations, no publishable config, no queue/cache/event wiring.
  • Optional-looking GraphQL support is registered unconditionally in bootAddon() via GraphQL::addType(). Verify whether that is inert when GraphQL is unused, and whether Rebing\GraphQL must be resolvable at boot.
  • The transform logic is trivial and readable: process() splits comma strings into arrays, augment() is a passthrough. A reviewer can fully understand the package in under an hour.

Technical risk

  • Blast radius is small. A failure degrades one CP field's editing experience, not request handling or stored content rendering — the stored JSON remains readable regardless.
  • Maturity signals are weak even though the release date is recent: 15 stars, 0 dependents, a single maintainer, no PHPUnit suite, no Pint or PHPStan configured. Any regression from a Statamic core bump lands on the consuming team to detect manually.
  • Vue 2 is end-of-life upstream. This is tolerable only because Statamic's CP is still Vue 2 today; a Statamic Vue 3 migration forces this component to be rewritten or replaced.
  • Data-shape asymmetry is the sharpest edge. CP-authored values are arrays; process() normalizes comma-separated strings into arrays; augment() passes through untouched. Content written via API, import scripts, or legacy fields can surface as a bare string in templates. Any template contract must defend against both.
  • GraphQL resolves value via Arr::first(), so multi-color swatches are lossy at the API boundary.
  • Committed dist/ can silently diverge from resources/ if the source is patched without a rebuild.

Key questions

  • Which Statamic major is in production, and what is the committed upgrade window to v7?
  • Is GraphQL in use, and does any consumer need all colors rather than the first?
  • Is content authored exclusively in the CP, or also via API/imports (which reintroduces the string-vs-array case)?
  • Will the field be nested inside Replicator/Grid/Bard, and is the index component verified in collection listings?
  • What is the exit cost — can a plain select fieldtype with hex options reproduce the same template output?
  • Is a maintained internal fork acceptable if upstream goes quiet?

Integration Approach

Stack fit

  • Valid only where Statamic v6 is the CMS. If the platform decision is unsettled, defer — the package is contingent on that choice, not the reverse.
  • Good fit where editors pick from a predefined palette (status colors, brand accents) and developers control the blueprint.

Migration path

  • No schema migration; content is stored as field JSON within the entry.
  • Migrating from an existing select/color field requires a one-off transform to { label, value: [...] }. Do this as an explicit backfill script over revisions, not an in-place overwrite, so rollback stays possible.

Compatibility

  • Statamic v6.x, PHP 8.x, Vue 2 CP runtime. Confirm Rebing\GraphQL availability before enabling GraphQL anywhere in the schema.
  • No Node build required at install; treat the committed dist/ as the shipped artifact and do not run the Vite build in the consuming app.

Sequencing

  1. Branch spike: composer require, register the addon, confirm the fieldtype appears in a blueprint and round-trips a save/load.
  2. Author the palette as developer-owned blueprint config; editors select, they do not define colors.
  3. Define the template contract immediately — a single Antlers/Blade partial that normalizes string-vs-array and exposes label plus first color. Do not let {{ value }} leak raw shapes into templates.
  4. Handle nested contexts (Replicator/Grid/Bard) and confirm the index component in listings.
  5. Run the legacy-color backfill on a copy, diff rendered output, then apply.
  6. If GraphQL is in play, assert the ColorSwatchType shape and decide whether first-color-only is acceptable or needs a custom resolver.
  7. Ship alongside the old field for one release cycle behind a blueprint-level switch; remove the old field once entry rendering is verified.

Rollback

  • Reverting the composer dependency and blueprint leaves stored JSON inert. No destructive state.

Operational Impact

Maintenance

  • Small surface area, but zero automated safety net. Budget roughly half a day of manual verification per Statamic major/minor upgrade: field loads, swatch renders, value saves, index column renders.
  • Pin the version rather than floating ^. A solo-maintainer patch release should not reach production unreviewed.
  • Keep a fork-readiness note. The package is a few hundred lines; forking is measured in hours, not weeks.

Support

  • Community-only, GitHub issues, no SLA. Requires an internal runbook covering where palettes are configured, how to add a color, and the template partial's contract.
  • Assign a named owner for the blueprint config so palette changes do not drift into ad-hoc per-field definitions.

Scaling

  • No meaningful runtime cost: no queries, no cache, no queue, tiny JSON payloads. CP render cost is bounded by swatch count per field.
  • The scaling risk is editorial, not technical: without shared palette presets, teams duplicate color definitions across blueprints and lose consistency. Govern palettes centrally.

Failure modes

  • Statamic v7 / Vue 3 upgrade breaks the CP component. Detection is silent — values still persist, editors simply cannot edit visually.
  • GraphQL schema resolution fails at boot if the Rebing type or Statamic GraphQL bridge is absent.
  • String-vs-array data drift yields empty or malformed template output.
  • dist/ drift means source fixes never reach consumers.

Ramp-up

  • Developers: roughly half a day to read the source, wire the blueprint, and write the template partial.
  • Editors: minutes. Click a swatch. Palette changes remain a developer task unless blueprint UI access is granted.
  • Design/content: needs a documented color source of truth up front, otherwise the swatch lists become a second, unsynchronized palette.

TPM recommendation

  • Adopt as a low-risk convenience with a thin internal wrapper, not as a design-system primitive. The integration cost is trivial and the exit cost is trivially low, which offsets the weak maturity signals (15 stars, 0 dependents, no tests). Treat the low opportunity score as untapped upstream scope — tests, token integration, multi-color GraphQL — that we should not assume will be delivered.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel