50% between 2 colors button

Something I do quite often is choose a color, set opacity to 50%(ish), and then draw over another color in order to get a halfway point between the two colors. However, when I set the opacity, it is not always exactly 50% since it is a slider, and so sometimes when working with existing sprites, it is a bit more trouble to make sure that these 50% colors are always the same.

So, it would be useful if there was a button that automatically gives you a color between color 1 and color 2, like this:
4686135bc049bdbfa06eb0e49a46e737

I think some kind of function related to color could be placed there, since there is a lot of space, and you rarely click on the sides.

1 Like

The colour selector area can be resized and made quite small, so that space is not guaranteed to be there and should probably not be used.

I would like to see something like this added though. I don’t think it needs to be a button on the main UI, but as a hotkeyable menu item it would be great. Perhaps an Eyedropper Pick mode, “blend with current colour” or something, so you can use the Eyedropper several times to get more of the colour added in.

For now, this can be done with a script that just sets your foreground colour to halfway between FG and BG.

Maybe a button up here then? (Since you usually want to do it after picking colors)

For my particular use case, I wouldn’t want it to be a mode, since that takes a little longer to change.
Best case scenario it’s a button, or a hotkey.

A script would be perfect for this since you can put it on a hotkey. Here’s a script that blends your background and foreground colours, and sets your foreground colour to the result.

do
    local bg = app.bgColor
	local fg = app.fgColor
	local newColor
	
	newColor = fg
	
	local fg_alpha = 0.5
	local fg_r = fg.red/255 * fg_alpha
	local fg_g = fg.green/255 * fg_alpha
	local fg_b = fg.blue/255 * fg_alpha
	
	local bg_alpha = 1.0
	local bg_r = bg.red/255 * bg_alpha
	local bg_g = bg.green/255 * bg_alpha
	local bg_b = bg.blue/255 * bg_alpha
	
	newColor.alpha = 255
	newColor.red = 		255 * (fg_r + bg_r*(1-fg_alpha))
	newColor.green = 	255 * (fg_g + bg_g*(1-fg_alpha))
	newColor.blue = 	255 * (fg_b + bg_b*(1-fg_alpha))
		
	app.fgColor = newColor
end

Note that it completely disregards the alpha of your BG/FG colours. If you want the average of their opacities as well, then change newColor.alpha = 255 to newColor.alpha = (fg.alpha + bg.alpha)/2.

This script doesn’t give quite the same results as Aseprite because I had to reimplement the colour math since Aseprite doesn’t provide any blending functions in the scripting API, and the script rounds differently from Aseprite. This should not be a significant difference, it’s at most 1 in every channel.

2 Likes