{"id":51,"date":"2002-06-20T02:28:55","date_gmt":"2002-06-20T02:28:55","guid":{"rendered":"http:\/\/dev.jblove.net\/?p=51"},"modified":"2002-06-20T02:28:55","modified_gmt":"2002-06-20T02:28:55","slug":"%ec%83%89%ec%83%81-%ec%84%a0%ed%83%9d%ea%b8%b0color-picker","status":"publish","type":"post","link":"https:\/\/jblove.net\/?p=51","title":{"rendered":"\uc0c9\uc0c1 \uc120\ud0dd\uae30[color picker]"},"content":{"rendered":"<p>\n<? <br \/>\n$value_name = urldecode($value); <\/p>\n<p>\/\/ HSV\ub97c RGB\ub85c \ubcc0\ud658\ud558\uc5ec HTML \uc0c9\uc0c1\uc73c\ub85c \ubc18\ud658 <br \/>\n\/\/ \uc778\ud130\ub137\uc5d0\uc11c \uad6c\ud55c C \uc18c\uc2a4\ub97c php \ub85c \ubcc0\ud658\ud568 <br \/>\nfunction hsv2rgb($h, $s, $v) <br \/>\n{ <br \/>\n$v1 = $v * 2.55; <br \/>\nif($s == 0) <br \/>\n{ <br \/>\n$r = $g = $b = $v1; <br \/>\n$str = sprintf(&#8220;#%02X%02X%02X&#8221;, $r, $g, $b); <br \/>\nreturn $str; <br \/>\n} <\/p>\n<p>$h2 = $h%32; <br \/>\n$h2 = abs(16-$h2); <\/p>\n<p>$aa = $v1; <br \/>\n$bb = ($v1 * (100-$s))\/100; <br \/>\n$cc = ($h2 * ($aa &#8211; $bb))\/16+$bb; <\/p>\n<p>if( 0 <= $h &#038;&#038; $h < 16){ $r = $aa; $g = $bb; $b = $cc;} <br \/>\nif( 16 <= $h &#038;&#038; $h < 32){$r = $aa; $g = $cc; $b = $bb;} <br \/>\nif( 32 <= $h &#038;&#038; $h < 48){$r = $cc; $g = $aa; $b = $bb;} <br \/>\nif( 48 <= $h &#038;&#038; $h < 64){$r = $bb; $g = $aa; $b = $cc;} <br \/>\nif( 64 <= $h &#038;&#038; $h < 80){$r = $bb; $g = $cc; $b = $aa;} <br \/>\nif( 80 <= $h &#038;&#038; $h <= 100){$r = $cc; $g = $bb; $b = $aa;} \n\n\n$str = sprintf(&#8220;#%02X%02X%02X&#8221;, $r, $g, $b); <br \/>\nreturn $str; <br \/>\n} <\/p>\n<p>echo(&#8220;<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0\/\/EN\"><br \/>\n&#8220;. <br \/>\n&#8220;<html><br \/>\n&#8220;. <br \/>\n&#8220;<head><br \/>\n&#8220;. <br \/>\n&#8220;<title>ColorPicker<\/title><br \/>\n&#8220;. <br \/>\n&#8220;<meta http-equiv=\"Content-Type\" content=\"text\/html;charset=euc-kr\"><br \/>\n&#8220;. <br \/>\n&#8220;<\/p>\n<style type=\"text\/css\">\n\". <br \/>\n\"<!--<br \/>\n\". <br \/>\n\"#tb{border-style:outset;border-color:white;border-width:2px}<br \/>\n\". <br \/>\n\"#title{text-align:center;width:100%;height:20px;background-color:aqua;boeder-style:solid;border-color:blue;border-width:1px;padding:4px;}<br \/>\n\". <br \/>\n\"#sel{background-color:aqua}<br \/>\n\". <br \/>\n\"--><br \/>\n\". <br \/>\n\"<\/style>\n<p><\/head><br \/>\n&#8220;. <br \/>\n&#8220;<script language=\"JavaScript1.2\" type=\"text\/JavaScript\"><br \/>\n\". <br \/>\n\"<!--<br \/>\n\". <br \/>\n\"function UpdateParent(value)<br \/>\n\". <br \/>\n\"{<br \/>\n\". <br \/>\n\"opener.document.form.$value_name.value = value;<br \/>\n\". <br \/>\n\"window.close();<br \/>\n\". <br \/>\n\"}<br \/>\n\". <br \/>\n\"function set(color)<br \/>\n\". <br \/>\n\"{<br \/>\n\". <br \/>\n\"title.style.backgroundColor = color;<br \/>\n\". <br \/>\n\"sel.style.backgroundColor = color;<br \/>\n\". <br \/>\n\"}<br \/>\n\". <br \/>\n\"\/\/--><br \/>\n\". <br \/>\n\"<\/script><br \/>\n&#8220;. <br \/>\n&#8220;<body bgcolor=\"white\" text=\"black\" link=\"blue\" vlink=\"purple\" alink=\"red\"><br \/>\n&#8220;. <br \/>\n&#8220;<\/p>\n<div align=\"center\">\n&#8220;. <br \/>\n&#8220;<\/p>\n<table border=\"1\" bordercolor=\"black\">\n&#8220;. <br \/>\n&#8220;<\/p>\n<tr>\n&#8220;. <br \/>\n&#8220;<\/p>\n<td id=\"title\">\n&#8220;. <br \/>\n&#8220;<b>ColorPicker<\/b><br \/>\n&#8220;. <br \/>\n&#8220;<\/td>\n<\/tr>\n<p>\n&#8220;. <br \/>\n&#8220;<\/p>\n<td align=\"center\">\n&#8220;. <br \/>\n&#8220;<\/p>\n<table id=\"tb\" cellpadding=\"0\" cellspacing=\"0\">\n&#8220;); <\/p>\n<p>\/\/ \uc0c9\uc0c1 \ud14c\uc774\ube14 \ucd9c\ub825 <br \/>\nfor($cs = 0; $cs < 100; $cs+=4) <br \/>\n{ <br \/>\necho(&#8220;<\/p>\n<tr>\n&#8220;); <br \/>\nfor($ch = 0; $ch < 100; $ch+=4) <br \/>\n{ <br \/>\n$color = hsv2rgb($ch, $cs, 100); \/\/ \uc0c9\uc0c1 \ubc1d\uae30 100 \uc73c\ub85c \uace0\uc815 &#8230; <br \/>\necho(&#8220;<\/p>\n<td id=\"tb\" bgcolor=\"$color\">&#8220;. <br \/>\n&#8220;<a href=\"javascript:UpdateParent('$color')\" onMouseOver=\"set('$color')\">&#8220;. <br \/>\n&#8220;<font size=\"1\" color=\"$color\">CC<\/font><\/a><\/td>\n<p>\n&#8220;); <br \/>\n} <br \/>\necho(&#8220;<\/tr>\n<p>\n&#8220;); <br \/>\n} <\/p>\n<p>\necho(&#8220;<\/table>\n<\/div>\n<p>\n&#8220;. <br \/>\n&#8220;<\/p>\n<div align=\"center\">\n&#8220;. <br \/>\n&#8220;<\/p>\n<table border=\"0\" cellspacing=\"0\" width=\"100%\">\n&#8220;. <br \/>\n&#8220;<\/p>\n<tr>\n&#8220;. <br \/>\n&#8220;<\/p>\n<td id=\"sel\" align=\"center\">\n&#8220;. <br \/>\n&#8220;<font size=\"2\" color=\"blue\"><b>\uc0c9\uc0c1\uc744 \uc120\ud0dd\ud558\uc138\uc694<\/b><\/font><\/td>\n<p>\n&#8220;. <br \/>\n&#8220;<\/tr>\n<p>\n&#8220;. <br \/>\n&#8220;<\/table>\n<\/div>\n<p>\n&#8220;. <br \/>\n&#8220;<\/table>\n<\/div>\n<p>\n&#8220;. <br \/>\n&#8220;<\/p>\n<p>< <br \/>\nbr><\/p>\n<p>&#8220;. <br \/>\n&#8220;<\/body><\/html><br \/>\n&#8220;); <br \/>\n?> <\/p>\n<p>\n\ub2e4\uc74c\uc740 \ud14c\uc2a4\ud2b8\uc6a9 \ud30c\uc77c\uc785\ub2c8\ub2e4. <\/p>\n<p>test.php <\/p>\n<p><!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0\/\/EN\"> <br \/>\n<html> <br \/>\n<head> <br \/>\n<meta http-equiv=\"Content-Type\" content=\"text\/html;charset=euc-kr\"> <\/p>\n<p><script language=\"JavaScript1.2\" type=\"text\/JavaScript\"> <br \/>\n<!-- <br \/>\nfunction ColorWin(page) <br \/>\n{ <br \/>\nwindow.open(page, 'newW2', 'width=500, height=500, toolbar=0,location=0, scrollbars=1, statusbar=0, resizable = 1'); <br \/>\n} <br \/>\n\/\/--> <br \/>\n<\/script> <br \/>\n<\/head> <br \/>\n<body> <\/p>\n<form name=\"form\">\n<input type=\"text\" name=\"mycolor\" maxlength=\"7\" size=\"7\"> <br \/>\n<a href=\"javascript:ColorWin('select_color.php?value=<? echo(urlencode(\"mycolor\")); ?>&#8216;)&#8221;> <br \/>\nColorPicker<\/a> <br \/>\n<\/form>\n<p>\n<\/body> <br \/>\n<\/html> <\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[51],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-papa-php"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":0,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"wp:attachment":[{"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}