The latest fad is these proximity sensors which can be had for as little as $2 for inductive and $5 for capacitive (including shipping):
The downside is that they require more than the 5v powersupply that is available on most endstop connectors and that the output when triggered is also the same as the voltage supplied to run them so you cannot just hook them up directly, however with a simple voltage divider we can bring that down to just below 5v again and hook them up using only two resistors:
The resulting output voltage is around 4.8v.
Something else to be aware of is that on some brands the colours aren't written in English and potentially may not be using the same colours as everyone else.
to use inductive sensors you will need something metallic as a flag and the sensing range is around 2 - 4 mm depending on the material, you can use just about anything though eg tinfoil, small screws even though the manufacturer will say the sensing range is for example 4mm it doesn't actually mean you can sense an aluminium bed through 4mm of glass.
to use the capacitive sensors there is usually a small tuning screw on the back since the sensor will pick up just about anything around it's sensing tip make sure when you turn this screw to tune it that you keep your fingers clear of it , it's also a good idea for repeat-ability sake to use the smallest practical sensing distance.