colorToAlpha for a color range or threshold

I’m overlaying a ‘partial’ map over a larger map layer. The partial map is aerial photography, and the base layer is OSM. The aerial map is white around the actual imagery (the missing bits are white).
I’m using colorToAlpha to suppress those white areas, to create a nice smooth transition to the base layer. However, the layer’s white bits aren’t pure white close to the edges of the photographic areas resulting in a smudgy whitish border around it.
see: smudgy borders
This could be improved if we could specify a threshold value (near white) above which everything would be transparent. Is there any way to accomplish this?

Update: Some more delving into the documentation brings up colorToAlphaThreshold, which does the trick nicely.