@@ -88,6 +88,15 @@ This does not modify the current object, it creates a new one instead.
8888#### Returns
8989` Object ` An object with h, s, v and a fields.
9090
91+ #### Example
92+
93+ <script>
94+ var color = kendo.parseColor("#ff0000");
95+ var hsvColor = color.toHSV();
96+ /* The result can be observed in the DevTools(F12) console of the browser. */
97+ console.log(hsvColor); // logs {h: 0, s: 1, v: 1, a: 1}
98+ </script>
99+
91100### toRGB
92101
93102Returns the color in RGB representation. The result has the following
@@ -104,6 +113,15 @@ This does not modify the current object, it creates a new one instead.
104113
105114` Object ` An object with r, g, b and a fields.
106115
116+ #### Example
117+
118+ <script>
119+ var color = kendo.parseColor("#ff0000");
120+ var rgbColor = color.toRGB();
121+ /* The result can be observed in the DevTools(F12) console of the browser. */
122+ console.log(rgbColor); // logs {r: 1, g: 0, b: 0, a: 1}
123+ </script>
124+
107125### toBytes
108126
109127Returns the color in "Bytes" representation. It has the same properties as
@@ -114,6 +132,15 @@ This does not modify the current object, it creates a new one instead.
114132#### Returns
115133` Object ` An object with r, g and b fields.
116134
135+ #### Example
136+
137+ <script>
138+ var color = kendo.parseColor("#ff0000");
139+ var bytesColor = color.toBytes();
140+ /* The result can be observed in the DevTools(F12) console of the browser. */
141+ console.log(bytesColor); // logs {r: 255, g: 0, b: 0, a: 1}
142+ </script>
143+
117144### toHex
118145
119146Returns a string in ` "FF0000" ` form (without a leading ` # ` ).
@@ -122,6 +149,14 @@ Returns a string in `"FF0000"` form (without a leading `#`).
122149
123150` String ` The color in hex notation.
124151
152+ #### Example
153+
154+ <script>
155+ var color = kendo.parseColor("#ff0000");
156+ /* The result can be observed in the DevTools(F12) console of the browser. */
157+ console.log(color.toHex()); // logs "ff0000"
158+ </script>
159+
125160### toCss
126161
127162Like ` toHex ` , but includes a leading ` # ` .
@@ -130,6 +165,14 @@ Like `toHex`, but includes a leading `#`.
130165
131166` String ` The color in CSS notation.
132167
168+ #### Example
169+
170+ <script>
171+ var color = kendo.parseColor("#ff0000");
172+ /* The result can be observed in the DevTools(F12) console of the browser. */
173+ console.log(color.toCss()); // logs "#ff0000"
174+ </script>
175+
133176### toCssRgba
134177
135178Returns the color in RGBA notation (includes the opacity).
@@ -138,6 +181,18 @@ Returns the color in RGBA notation (includes the opacity).
138181
139182` String ` The color in RGBA notation.
140183
184+ #### Example
185+
186+ <script>
187+ var color = kendo.parseColor("#ff0000");
188+ /* The result can be observed in the DevTools(F12) console of the browser. */
189+ console.log(color.toCssRgba()); // logs "rgba(255, 0, 0, 1)"
190+
191+ var transparentColor = kendo.Color.fromRGB(1, 0, 0, 0.5);
192+ /* The result can be observed in the DevTools(F12) console of the browser. */
193+ console.log(transparentColor.toCssRgba()); // logs "rgba(255, 0, 0, 0.5)"
194+ </script>
195+
141196### toDisplay
142197
143198Returns the color in the best notation supported by the current browser. In
@@ -148,21 +203,65 @@ RGBA form.
148203
149204` String ` The color in the best notation supported by the current browser.
150205
206+ #### Example
207+
208+ <script>
209+ var color = kendo.parseColor("#ff0000");
210+ /* The result can be observed in the DevTools(F12) console of the browser. */
211+ console.log(color.toDisplay()); // logs "rgba(255, 0, 0, 1)" in modern browsers
212+ </script>
213+
151214
152215## Fields
153216
154217### r ` Number `
155218
156219The red channel of the color, in the range from 0 to 1.
157220
221+ #### Example
222+
223+ <script>
224+ var color = kendo.parseColor("#ff0000");
225+ /* The result can be observed in the DevTools(F12) console of the browser. */
226+ console.log(color.r); // logs 1
227+
228+ var greenColor = kendo.parseColor("#00ff00");
229+ /* The result can be observed in the DevTools(F12) console of the browser. */
230+ console.log(greenColor.r); // logs 0
231+ </script>
232+
158233### g ` Number `
159234
160235The green channel of the color, in the range from 0 to 1.
161236
237+ #### Example
238+
239+ <script>
240+ var color = kendo.parseColor("#00ff00");
241+ /* The result can be observed in the DevTools(F12) console of the browser. */
242+ console.log(color.g); // logs 1
243+
244+ var redColor = kendo.parseColor("#ff0000");
245+ /* The result can be observed in the DevTools(F12) console of the browser. */
246+ console.log(redColor.g); // logs 0
247+ </script>
248+
162249### b ` Number `
163250
164251The blue channel of the color, in the range from 0 to 1.
165252
253+ #### Example
254+
255+ <script>
256+ var color = kendo.parseColor("#0000ff");
257+ /* The result can be observed in the DevTools(F12) console of the browser. */
258+ console.log(color.b); // logs 1
259+
260+ var redColor = kendo.parseColor("#ff0000");
261+ /* The result can be observed in the DevTools(F12) console of the browser. */
262+ console.log(redColor.b); // logs 0
263+ </script>
264+
166265
167266## Static Methods
168267
0 commit comments