함수 str2rgb()

Jmnote (토론 | 기여)님의 2015년 1월 22일 (목) 16:02 판 (새 문서: 분류: String 분류: Color ==PHP== category: PHP <source lang='php'> function stringToRgb( $str ) { $code = dechex(crc32(md5($str))); $r = hexdec(substr($code,0,2))...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)


PHP

function stringToRgb( $str ) {
  $code = dechex(crc32(md5($str)));
  $r = hexdec(substr($code,0,2))/2+127;
  $g = hexdec(substr($code,2,2))/2+127;
  $b = hexdec(substr($code,4,2))/2+127;
  return dechex($r).dechex($g).dechex($b);
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}