{"id":1512,"date":"2015-11-19T22:48:07","date_gmt":"2015-11-19T22:48:07","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1512"},"modified":"2015-11-19T22:48:38","modified_gmt":"2015-11-19T22:48:38","slug":"how-to-convert-kml-color-to-htmlrgb-color-code-kml-to-rgb-conversion","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/11\/how-to-convert-kml-color-to-htmlrgb-color-code-kml-to-rgb-conversion\/","title":{"rendered":"How to convert KML color  to HTML\/RGB color code (KML to RGB conversion) ?"},"content":{"rendered":"<p>If you are KML user and you have to use KML defined color in html elements you need to use this. <\/p>\n<pre>\r\nfunction hex2rgb(value) {\r\n  var color = \"#\" + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4);\r\nreturn color;\r\n}\r\n\r\nvar colour = hex2rgb(\"99FF11AA\");\r\n\r\n$(function() {\r\n    $(\"#output\").css(\"backgroundColor\",colour); \r\n});\r\n<\/pre>\n<p>Output color code &#8211;<br \/>\n<a href=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/11\/kml-to-rgb-color-code.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/11\/kml-to-rgb-color-code.png\" alt=\"kml-to-rgb-color-code\" width=\"483\" height=\"105\" class=\"aligncenter size-full wp-image-1513\" srcset=\"https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/11\/kml-to-rgb-color-code.png 483w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/11\/kml-to-rgb-color-code-300x65.png 300w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are KML user and you have to use KML defined color in html elements you need to use this. function hex2rgb(value) { var color = &#8220;#&#8221; + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4); return color; } var colour = hex2rgb(&#8220;99FF11AA&#8221;); $(function() { $(&#8220;#output&#8221;).css(&#8220;backgroundColor&#8221;,colour); }); Output color code &#8211;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[53,27],"tags":[],"class_list":["post-1512","post","type-post","status-publish","format-standard","hentry","category-cesiumjs","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1512"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1512\/revisions"}],"predecessor-version":[{"id":1514,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1512\/revisions\/1514"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}