Color

New in version 12.0: The TCA type color has been introduced. It replaces the renderType=colorpicker of TCA type input.

New in version 13.0: When using the color type, TYPO3 takes care of generating the according database field. A developer does not need to define this field in an extension's ext_tables.sql file.

The TCA type color should be used to render a JavaScript-based color picker.

New in version 13.0.

Color palettes can be defined via page TSconfig. This way, for example, colors defined in a corporate design can be selected by a simple click.

Examples

A simple color picker:

'a_color_field' => [
    'label' => 'Color field',
    'config' => [
        'type' => 'color',
    ]
]

Migration

A complete migration from renderType=colorpicker to type=color looks like the following:

// Before

'a_color_field' => [
    'label' => 'Color field',
    'config' => [
        'type' => 'input',
        'renderType' => 'colorpicker',
        'required' => true,
        'size' => 20,
        'max' => 1024,
        'eval' => 'trim',
        'valuePicker' => [
            'items' => [
                ['typo3 orange', '#FF8700'],
            ],
        ],
    ],
],

// After

'a_color_field' => [
    'label' => 'Color field',
    'config' => [
        'type' => 'color',
        'required' => true,
        'size' => 20,
        'valuePicker' => [
            'items' => [
                ['typo3 orange', '#FF8700'],
            ],
        ],
    ]
]

An automatic TCA migration is performed on the fly, migrating all occurrences to the new TCA type and triggering a PHP E_USER_DEPRECATED error where code adoption has to take place.