2013-07-09 4 views
-1

이런 종류의 색상 표를 만드는 도구가 있습니까? 내가 입력 HEX 색상의 목록을 원하고 이런 식으로 뭔가를 다시 얻을 :16 진수 색상 표 만들기

HEX color example

내가 자동 도구 그러나 구글의 3 페이지와 여전히 아무것도를 찾기 위해 모든 것을 검색. 누구나 손으로 이러한 종류의 표를 만들고 싶은 이유를 생각할 수 없으며 여러 가지로 나왔습니다. HEX 색상을 시각적으로 표현하는 도구가 있어야합니다.

+0

글쎄, "google"3 페이지는 많은 노력을하지는 않지만 물어보기 전에 검색 엔진을 사용하지 말라고 알리바이와 비슷합니다. 검색에 사용한 용어가 무엇입니까? ? 어쩌면 당신은 뭔가 다른 것을 찾아야 할 필요가 있을까요? – Samoth

+0

나는 이미 그것을 고쳤다. 조합 생성기를 사용하여 가능한 모든 16 진수 색상 목록을 만들었습니다. 0-9 및 A-F를 지정하고 16 진수 코드 주위에 '테이블'을 편집합니다. 때때로 검색 엔진을 사용하는 것은 해결책이 아니지만 사람들과 대화하는 것은 중요합니다. – mvaneijgen

+0

글쎄, 그래. 흠, 당신이 내 노력을 존중하고 싶다면, 당신이 적절한 해결책으로 받아들이 길 원치 않을 때 적어도 내 해결책을 upvote하는 것이 좋을 것입니다 ...--) 코드를 작성하는 것은 재미있었습니다. 하지만 그것은 시간이 좀 걸리고 당신의 질문을 이해하는 한, 잘 작동합니다 ... – Samoth

답변

0

좋아, 여기 내 솔루션은 AutoIt이에있다 : http://jtmeyer.de/hexColors.exe :

#include <GUIConstants.au3> 
#include <Array.au3> 
#include <StaticConstants.au3> 
#include <ButtonConstants.au3> 
#include <WindowsConstants.au3> 
#include <Color.au3> 


$defaultHexCodes = "003366,003399,0033CC,0033FF,006633,006699,0066CC,0066FF,009933,009966,0099CC,0099FF,00CC33,00CC66,00CC99,00CCFF,00FF33,00FF66,00FF99,00FFCC,330066,330099,3300CC,3300FF,336600,336699,3366CC,3366FF,339900,339966,3399CC,3399FF,33CC00,33CC66,33CC99,33CCFF,33FF00,33FF66,33FF99,33FFCC,660033,660099,6600CC,6600FF,663300,663399,6633CC,6633FF,669900,669933,6699CC,6699FF,66CC00,66CC33,66CC99,66CCFF,66FF00,66FF33,66FF99,66FFCC,990033,990066,9900CC,9900FF,993300,993366,9933CC,9933FF,996600,996633,9966CC,9966FF,99CC00,99CC33,99CC66,99CCFF,99FF00,99FF33,99FF66,99FFCC,CC0033,CC0066,CC0099,CC00FF,CC3300,CC3366,CC3399,CC33FF,CC6600,CC6633,CC6699,CC66FF,CC9900,CC9933,CC9966,CC99FF,CCFF00,CCFF33,CCFF66,CCFF99,FF0033,FF0066,FF0099,FF00CC,FF3300,FF3366,FF3399,FF33CC,FF6600,FF6633,FF6699,FF66CC,FF9900,FF9933,FF9966,FF99CC,FFCC00,FFCC33,FFCC66,FFCC99" 
$defaultHexCodes = StringSplit($defaultHexCodes, ",", 2) 

Global $cols = 6 

GUICreate("HexColors", 640, 480) 
$inpHexCodes = GUICtrlCreateEdit(_ArrayToString($defaultHexCodes, @CRLF), 10, 10, 80, 430) 
$inpCols = GUICtrlCreateInput($cols, 10, 450, 40, 20) 
$btnGenerate = GUICtrlCreateButton("Gen", 60, 450, 30, 20) 
GUICtrlCreateUpdown($inpCols) 
$image = GUICtrlCreateGraphic(100, 10, 530, 460) 
GUICtrlSetState($btnGenerate, $GUI_FOCUS) 

Global $labels[1] = [GUICtrlCreateLabel("Hex-Code-Table", 100, 10, 530, 460, $SS_CENTER)] 
GUISetState() 

$hexCodes = $defaultHexCodes 

Do 
    $msg = GUIGetMsg() 
    Switch $msg 
     Case $inpCols 
     $cols = GUICtrlRead($inpCols) 
     If $cols < 1 Then GUICtrlSetData($inpCols, 1) 
     If $cols > 16 Then GUICtrlSetData($inpCols, 16) 
     Case $btnGenerate 
     $newHexCodes = GUICtrlRead($inpHexCodes) 
     $newHexCodes = StringReplace($newHexCodes, @CR, "|") 
     $newHexCodes = StringStripWS($newHexCodes, 8) 
     ConsoleWrite("read new hex codes... ") 
     $hexCodes = StringSplit($newHexCodes, "|", 2) 
     For $index = UBound($hexCodes) - 1 To 0 Step -1 
      $hexCode = $hexCodes[$index] 
      If StringIsXDigit($hexCode) Then 
       $hexCodes[$index] = "0x" & $hexCode 
      Else 
       MsgBox(0, "Error", $hexCode & " is not a hexadecimal code - will be remove") 
       _ArrayDelete($hexCodes, $index) 
      EndIf 
     Next 
     ConsoleWrite("found " & UBound($hexCodes) & @CR) 

     GenerateHexTable() 
    EndSwitch 
Until $msg == $GUI_EVENT_CLOSE 


Func GenerateHexTable() 
    GUICtrlDelete($image) 
    For $label In $labels 
     GUICtrlDelete($label) 
    Next 

    $w = 530 
    $h = 460 

    ; CleanUp 
    $image = GUICtrlCreateGraphic(100, 10, 530, 460) 
    GuiCtrlSetState($image, $GUI_DISABLE) 

    $hexCodesSize = UBound($hexCodes) 
    ReDim $labels[$hexCodesSize] 

    $colWidth = $w/($cols) 
    $rowHeight = $h/Ceiling($hexCodesSize/($cols)) 

    $row = 0 
    $col = 0 
    $index = 0 
    While $index < $hexCodesSize 
     For $col = 0 to $cols - 1 
     $left = Int($colWidth * $col) + 3 
     $top = Int($rowHeight * $row) + 3 
     $index = $row * $cols + $col 
     If $index < UBound($hexCodes) Then 
      $hexCode = $hexCodes[$index] 
      GUICtrlSetGraphic($image, $GUI_GR_COLOR, 0, $hexCode) 
      GUICtrlSetGraphic($image, $GUI_GR_RECT, $left, $top, $colWidth - 3, $rowHeight - 3) 
      $labels[$index] = GUICtrlCreateLabel(StringMid($hexCode, 3), 100 + $left, 10 + $top, $colWidth - 3, $rowHeight - 3, $SS_CENTER, $WS_EX_TRANSPARENT) 
      If GetBrightness($hexCode) < 130 Then 
       GUICtrlSetColor($labels[$index], 0xffffff) 
      Else 
       GUICtrlSetColor($labels[$index], 0x000000) 
      EndIf 
      GUICtrlSetBkColor($labels[$index], $GUI_BKCOLOR_TRANSPARENT) 
     EndIf 
     Next 
     $row += 1 
    WEnd 
    GUICtrlSetGraphic($image, $GUI_GR_REFRESH) 
EndFunc 

; calculate perceived brightness (0-255) 
Func GetBrightness($color) 
    Return Sqrt(_ColorGetRed($color)^2 * 0.299 + _ColorGetGreen($color)^2 * 0.587 + _ColorGetBlue($color)^2 * 0.114) 
EndFunc 

당신은 나의 웹 공간에서이 코드의 컴파일 된 실행 파일을 다운로드 할 수 있습니다.