New to Telerik UI for PHP? Download free 30-day trial

\Kendo\UI\FlatColorPicker

A PHP wrapper for Kendo UI FlatColorPicker.

Inherits from \Kendo\UI\Widget.

Usage

To use FlatColorPicker in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo FlatColorPicker

<?php
// Create a new instance of FlatColorPicker and specify its id
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');

// Configure it
$flatColorPicker->autoupdate(true)

// Output it

echo $flatColorPicker->render();
?>

Methods

autoupdate

Specifies whether the UI should be updated while the user is typing in the input field, whenever a valid color can be parsed. If you passfalse for this, the widget will update only when ENTER is pressed.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->autoupdate(true);
?>

buttons

Specifies whether the widget should display the Apply / Cancel buttons.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->buttons(true);
?>

change

Triggers when a new color has been selected. For additional information check the change event documentation.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

columns

The number of columns to show in the palette. Also defines the width of the FlatColorPicker.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value float

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->columns(1);
?>

contrastTool

Enables the contrast tool in the ColorGradient.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean|\Kendo\UI\FlatColorPickerContrastTool|array

Example - using boolean

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->contrastTool(true);
?>

Example - using \Kendo\UI\FlatColorPickerContrastTool

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$contrastTool = new \Kendo\UI\FlatColorPickerContrastTool();
$backgroundColor = 'value';
$contrastTool->backgroundColor($backgroundColor);
$flatColorPicker->contrastTool($contrastTool);
?>

Example - using array

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$backgroundColor = 'value';
$flatColorPicker->contrastTool(array('backgroundColor' => $backgroundColor));
?>

format

Sets the default input format in the gradient input editor.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value string

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->format('value');
?>

formats

Sets the available input formats in the gradient input editor. Only "hex" and "rgb" are valid values.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value array

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->formats(array());
?>

input

Whether to render the input in ColorGradient component.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->input(true);
?>

messages

Allows customization of "Apply" / "Cancel" labels.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value \Kendo\UI\FlatColorPickerMessages|array

Example - using \Kendo\UI\FlatColorPickerMessages

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$messages = new \Kendo\UI\FlatColorPickerMessages();
$apply = 'value';
$messages->apply($apply);
$flatColorPicker->messages($messages);
?>

Example - using array

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$apply = 'value';
$flatColorPicker->messages(array('apply' => $apply));
?>

opacity

Specifies whether we should display the opacity slider to allow selection of transparency.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->opacity(true);
?>

palette

Specifies the color palette to display.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value string|array

Example - using string

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->palette('value');
?>

Example - using array

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->palette(array());
?>

preview

Specifies whether a selected and previous color are displayed for color comparison. with autoupdate set to true both selected and previous colors will be updated.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value boolean

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->preview(true);
?>

value

Specifies the initially selected color.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value string|

Example - using string

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->value('value');
?>

view

The initially selected view in the FlatColorPicker.

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value string

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->view('value');
?>

views

The available views in the FlatColorPicker. Valid values are "gradient" and "palette".

Returns

\Kendo\UI\FlatColorPicker

Parameters

$value array

Example

<?php
$flatColorPicker = new \Kendo\UI\FlatColorPicker('FlatColorPicker');
$flatColorPicker->views(array());
?>
In this article
Not finding the help you need?