The Kendo color picker is a drop down color picker widget.
This widget can be used as a replacement for the browser's built-in color picker widget in HTML 5.
This Kendo color picker is supported by most of the browsers.
Here is the code with MVVM pattern to implement the Kendo color picker.
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled</title>
-
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.common.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.rtl.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.default.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.mobile.all.min.css">
-
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.2.805/js/angular.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.2.805/js/jszip.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.2.805/js/kendo.all.min.js"></script></head>
- <body>
- <div id="example">
- <div class="demo-section k-header">
- <div>
- <h4>Choose a color and click Apply</h4>
- <input data-role="colorpicker"
- data-bind="visible: isVisible,
- enabled: isEnabled,
- value: selectedColor,
- events: { change: onChange }">
- </div>
-
- </div>
-
- <script>
- var viewModel = kendo.observable({
- selectedColor: null,
- isVisible: true,
- isEnabled: true,
- onChange: function() {
- alert(this.get("selectedColor"));
-
- }
- });
- kendo.bind($("#example"), viewModel);
- </script>
- </div>
- </body>
- </html>
Result in the browser:
I hope you have enjoyed this blog, Thank you.
Happy Coding.