PHPackages                             marbles/craft-colour-swatches - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. marbles/craft-colour-swatches

ActiveCraft-plugin

marbles/craft-colour-swatches
=============================

Let clients choose from a predefined set of colours.

1.2.8(6y ago)0122MITPHP

Since Jan 14Pushed 6y agoCompare

[ Source](https://github.com/Marbles/craft-colour-swatches)[ Packagist](https://packagist.org/packages/marbles/craft-colour-swatches)[ RSS](/packages/marbles-craft-colour-swatches/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (22)Used By (0)

[![Icon](./src/icon.svg)](./src/icon.svg)

[![Latest Version](https://camo.githubusercontent.com/9138f8a1589a3ace1b957b4671cf7d123ecc6f81e6f3da297d55856b2b68e03d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d6172626c65732f63726166742d636f6c6f75722d73776174636865732e7376673f7374796c653d666c61742d737175617265)](https://github.com/marbles/craft-colour-swatches/releases)[![Total Downloads](https://camo.githubusercontent.com/6cc1afd77e258a14381afa63fc2b7a2ecebd08960b1b48a3bdd266543322c922/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6172626c65732f63726166742d636f6c6f75722d73776174636865732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marbles/craft-colour-swatches)

Colour Swatches plugin for Craft CMS 3.x
========================================

[](#colour-swatches-plugin-for-craft-cms-3x)

Let clients choose from a predefined set of colours.

[![](./resources/img/screenshot.png)](./resources/img/screenshot.png)

This package used to be rias/craft-colour-swatches, but siince he abandoned his package he asked us to take it over. Feel free to use it!

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require marbles/craft-colour-swatches

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Colour Swatches.

Colour Swatches Overview
------------------------

[](#colour-swatches-overview)

Instead of providing a user a full color picker, Color Swatches gives an admin the ability to provide a selection of colors for a user to choose from.

Configuring Colour Swatches
---------------------------

[](#configuring-colour-swatches)

Create a Color Swatches field and provide label and hex value options.

[![Screenshot](./resources/img/single.png)](./resources/img/single.png)

Multiple colours are possible by seperating them with a comma

[![Screenshot](./resources/img/multiple.png)](./resources/img/multiple.png)

Using the config file
---------------------

[](#using-the-config-file)

You can create a `config/colour-swatches.php` file to predefine the possible colours or define different palettes. Take a look at the [config file](https://github.com/marbles/craft-colour-swatches/blob/master/src/config.php) in this repo for an example.

```
return [

    // Predefined colours
    'colours' => [
        [
            'label' => 'red',
            'color' => '#ff0000',
            'default' => false,
        ],
        [
            'label' => 'green',
            'color' => '#00ff00',
            'default' => false,
        ],
        [
            'label' => 'blue',
            'color' => '#0000ff',
            'default' => false,
        ],
        [
            'label' => 'pink',
            'color' => '#ff00ff',
            'default' => false,
        ]
    ],

    'palettes' => [
        'Red Green' => [
            [
                'label'   => 'red',
                'color'   => '#ff0000',
                'default' => false,
            ],
            [
                'label'   => 'green',
                'color'   => '#00ff00',
                'default' => false,
            ],
        ],
        'Buttons' => [
            [
                'label'   => 'blue-white',
                'color'   => '#0000ff,#ffffff',
                'default' => false,
            ],
            [
                'label'   => 'red-white',
                'color'   => '#ff0000, #ffffff',
                'default' => false,
            ],
        ],
    ],
];
```

In your field settings you can then have the possibility to have it use the predefined colours.

[![Screenshot](./resources/img/config.png)](./resources/img/config.png)

Using Colour Swatches
---------------------

[](#using-colour-swatches)

You can access both the label and color in your template. By default, the label will display:

```
{{ fieldName }}
{{ fieldName.label }}
{{ fieldName.labels }} {# Returns an array of all labels #}
{{ fieldName.color }}
{{ fieldName.colours }} {# Returns an array of all colours #}
```

Based on the awesome [Craft 2 plugin](https://github.com/vigetlabs/craft-color-swatches) from Vigetlabs

Brought to you by [Marbles](https://marbles.be)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~34 days

Total

21

Last Release

2252d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ccbf89d4b3fec03ad79d0a2183e9280d1c63a0fd65c399497b9414a083514c09?d=identicon)[kjellknapen](/maintainers/kjellknapen)

---

Top Contributors

[![kjellknapen](https://avatars.githubusercontent.com/u/13765389?v=4)](https://github.com/kjellknapen "kjellknapen (5 commits)")[![chasegiunta](https://avatars.githubusercontent.com/u/1377169?v=4)](https://github.com/chasegiunta "chasegiunta (3 commits)")[![craftedsystems](https://avatars.githubusercontent.com/u/26137287?v=4)](https://github.com/craftedsystems "craftedsystems (2 commits)")[![markmiddleton](https://avatars.githubusercontent.com/u/2645384?v=4)](https://github.com/markmiddleton "markmiddleton (2 commits)")[![benface](https://avatars.githubusercontent.com/u/1059139?v=4)](https://github.com/benface "benface (1 commits)")

---

Tags

cmsCraftcraftcmscraft-plugincolour-swatches

### Embed Badge

![Health badge](/badges/marbles-craft-colour-swatches/health.svg)

```
[![Health](https://phpackages.com/badges/marbles-craft-colour-swatches/health.svg)](https://phpackages.com/packages/marbles-craft-colour-swatches)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[craftpulse/craft-colour-swatches

Let clients choose from a predefined set of colours and utilise associated colour codes and class names in your templates.

3530.8k2](/packages/craftpulse-craft-colour-swatches)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)[verbb/social-poster

Automatically post entries to social media.

918.5k](/packages/verbb-social-poster)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
