Schoening Posted January 13, 2012 Posted January 13, 2012 (edited) This is a Quick one! Lets say i want to make the PixelGetColor not to take a exact match. If i want it to take diffrent Shades of Blue for instance. Lets say Bluelight gets the Value 100 from PixelGetColor and BlueDark gets 200 I want to take in the whole spectrum of Blue IF Pixelsearch > 250 Just some very bad, halfhearted example code to make my point more obvious Is there a list of Color Codes somewhere? Or can some simple math figure it out how the Color Code gets its numbers? Or can i even Convert Html color code with the right formula? Edited January 13, 2012 by Schoening
Malkey Posted January 14, 2012 Posted January 14, 2012 This may give you a few ideas. There are other ways of getting the individual colour channel values from a RGB colour. expandcollapse popupOpt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client HotKeySet("{ESC}", "Terminate") Local $exit = 1 While $exit Sleep(10) TtColXY() WEnd ; TtColXY() Tooltip shows colour, and cursor position relative to screen and window. Func TtColXY() $aPos = MouseGetPos() $sColor = "0x" & Hex(PixelGetColor($aPos[0], $aPos[1]), 6) $iPosX = ($aPos[0] - 100) * ($aPos[0] > @DesktopWidth * 0.90) + ($aPos[0] <= @DesktopWidth * 0.90) * ($aPos[0] + 3) $iPosY = ($aPos[1] - 30) * ($aPos[1] > @DesktopHeight * 0.96) + ($aPos[1] <= @DesktopHeight * 0.96) * ($aPos[1] + 3) $Red = Int("0x" & StringRegExpReplace($sColor, "(..)(..)(..)(..)", "\2")) $Green = Int("0x" & StringRegExpReplace($sColor, "(..)(..)(..)(..)", "\3")) $Blue = Int("0x" & StringRegExpReplace($sColor, "(..)(..)(..)(..)", "\4")) If $Blue > $Green And $Blue > $Red Then If $Blue > 200 Then $BShade = "Light" If $Blue <= 200 Then $BShade = "Dark" Else $BShade = "Nil" EndIf ToolTip("Color is: " & $sColor & @CRLF & _ " R:" & $Red & _ " G:" & $Green & _ " B:" & $Blue & @CRLF & _ "Shade of blue - " & $BShade) Return EndFunc ;==>TtColXY Func Terminate() $exit = 0 EndFunc ;==>Terminate
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now