Hello. how make a color complementary in two color pickers at same time, please

Hello to every body. i have this script

 

-------------------------------------//----------------------------------------

Rollout twocolor "complementary " 

(

Group "complimentary color:"

(

colorpicker theColor_ct  color:[0,0,255] modal:false  across:2  

colorpicker theColorb  color:[255,156,0] modal:false  

   on theColor_ct changed new_colct do theColorb.color = new_colct 

   on theColorb changed new_colb do theColor_ct.color = new_colb

 

)

)

createDialog twocolor 280 50

-------------------------------------//----------------------------------------

I could connect the two color picker, but as you can see gives the same color, please how should be the code so when i select a color in "theColor_ct", the color in the "theColorb" it will be the complementary and  backwards?

Thnaks for you time.Wink

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
themaxxer's picture

works like a charm...

works like a charm... thanks.
could you make it as macro script? I can't do it.

thanks
themaxxer

barigazy's picture

...

macroScript complementary category:"le1setreter" toolTip:"complementary in two color"
(
	try(destroyDialog ::twocolor)catch()
	Rollout twocolor "complementary " 
	(
		fn getComplColor baseColor =
		(
			origR = baseColor.r
			origG = baseColor.g
			origB = baseColor.b
 
			minRGB = amin origR origG origB
			maxRGB = amax origR origG origB
			minPlusMax = minRGB + maxRGB
 
			complColor = color (minPlusMax-origR) (minPlusMax-origG) (minPlusMax-origB)
		)	
		Group "complimentary color:"
		(
			colorpicker theColor_ct  color:[0,0,255] modal:false  across:2  
			colorpicker theColorb  color:[255,156,0] modal:false  
 
			on theColor_ct changed new_colct do theColorb.color = getComplColor new_colct
			on theColorb changed new_colb do theColor_ct.color = getComplColor new_colb
		)
	)
	createDialog twocolor 280 50 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)

barigazy

le1setreter's picture

try with this

try with this function:

Rollout twocolor "complementary " 
(
 
	fn getComplColor baseColor =
	(
		origR = baseColor.r
		origG = baseColor.g
		origB = baseColor.b
 
		minRGB = amin origR origG origB
		maxRGB = amax origR origG origB
		minPlusMax = minRGB + maxRGB
 
		complColor = color (minPlusMax-origR) (minPlusMax-origG) (minPlusMax-origB)
	)	
 
 
	Group "complimentary color:"
	(
 
	colorpicker theColor_ct  color:[0,0,255] modal:false  across:2  
	colorpicker theColorb  color:[255,156,0] modal:false  
 
	on theColor_ct changed new_colct do theColorb.color = getComplColor new_colct
	on theColorb changed new_colb do theColor_ct.color = getComplColor new_colb
 
	)
 
)
 
createDialog twocolor 280 50

i am not sure if the values are 100% exact. i took the formula from here:
http://forum.processing.org/topic/the-opposite-of-a-color

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.