a color palette dropdown

Installs: 6 291

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 5

Forks: 2

Open Issues: 1


v4.0.6 2023-08-29 22:15 UTC

This package is auto-updated.

Last update: 2024-05-30 00:01:40 UTC


Creates a colour palette dropdown for SilverStripe 3 or 4.

Color selector

OP color in the CMS

Create your accepted colors and names in the settings tab in the CMS

OP color in the settings

use the drop down to select your color

Expose the JS/css files

composer vendor-expose


	use OP\ColorField;
	public static $db = [
		'ClassOverride' => 'Text'

	function getCMSFields() {
		$fields = parent::getCMSFields();
		// create the op color field
		$colordropdown = ColorField::create('ClassOverride', 'Color Override', $this->ClassOverride);
		$fields->addFieldToTab("Root.Main", $colordropdown, "Content");
		return $fields;

What it does

It stores the CSSColor in the specified text field. Note the RGB color is the value that colors the box in the dropdown field. Other values, such as the CSSHex and CSSCMYK are optional.