parseColor

Parse a color string to a Color object. If the input is not valid throws an Error, unless the noerror argument is given.

Example

<script>
var red = kendo.parseColor("#ff0000");
</script>

Parameters

color String

A string in one of the following (case-insensitive) CSS notations:

  • #F00 (optionally without the sharp: F00)
  • #FF0000 (optionally without the sharp: FF0000)
  • rgb(255, 0, 0)
  • rgba(255, 0, 0, 1)

Particularly if this argument is null or the string "transparent" then this function will return null.

noerror Boolean(default: false)

If you pass true then this function will return undefined rather than throwing an error on invalid input.

Returns

kendo.Color A Color object.

In this article