Skip to content
Color field, this component is a part of the Olympus Zeus Core framework.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Color Field

This component is a part of the Olympus Zeus Core WordPress framework.
It uses the default WordPress color field.

Olympus Component CodeFactor Grade Packagist Version


Using composer in your PHP project:

composer require getolympus/olympus-color-field

Field initialization

Use the following lines to add a color field in your WordPress admin pages or custom post type meta fields:

return \GetOlympus\Field\Color::build('my_color_field_id', [
    'title'       => 'What is your favorite Coke?',
    'default'     => '#f40000',
    'description' => 'Zero and Light are not available colors!',

     * Color picker settings
     * @see
    'settings' => [
        'defaultColor' => false,
        'hide'         => true,
        'palettes'     => true,
        'width'        => 255,
        'mode'         => 'hsv',
        'type'         => 'full',
        'slider'       => 'horizontal',

Variables definitions

Variable Type Default value if not set Accepted values
title String 'Color' empty
default String empty Hex color code
description String empty empty
settings Array see Field initialization see WordPress reference

Retrive data

Retrieve your value from Database with a simple get_option('my_color_field_id', '') (see WordPress reference).

// Get color from Database
$color = get_option('my_color_field_id', '#f40000');

// Display Coca-Cola baseline in color
echo 'Always <b style="color:'.$color.'">Coca-Cola</b>';

Release History

  • 0.0.11
  • FIX: json encoder in twig source file
  • 0.0.10
  • FIX: remove twig dependency from composer
  • 0.0.9
  • FIX: remove zeus-core dependency from composer
  • 0.0.8
  • ADD: new version compatible with Zeus-Core latest version

Authors and Copyright

Achraf Chouk

Please, read LICENSE for more information.


  1. Fork it (
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Built with ♥ by Achraf Chouk ~ (c) since a long time.

You can’t perform that action at this time.