this is using the HCL colour space, which is a hue/chroma transformation of CIELUV, which is a perceptually uniform colour space (meaning, distance between colours in the colour space line up with human perception of how different the colours are).
it's restricted to the colours that are in sRGB by treating hue and lightness as fixed, and clamping the chroma to be in range. see here for an explanation of why it needs to be clamped.
secondary colours are chosen by picking two colours of the same chroma and lightness, but with hue shifted. near the left of the slider, the secondary colours will be split complementary, and near the right, they will be analogous.
i'm taking this big list of colours from a xkcd survey, transforming them to CIELUV, and then picking the nearest one to the selected colour.
there's some fun ones in there, like "ugly yellow" and "poop brown".