In HSL, a yellow and a blue at the same lightness look nothing alike. oklch() is built around how bright colors look to people, which makes palettes much easier to tune by hand.
:root {
--blue-300: oklch(80% 0.10 255);
--blue-500: oklch(62% 0.19 255);
--blue-700: oklch(45% 0.15 255);
--green-500: oklch(62% 0.19 150);
}
The three numbers are lightness (0% to 100%), chroma (how colorful, starting at 0) and hue as an angle. To make a lighter or darker shade, I’d change the first number. To make a matching color in another hue, keep lightness and chroma and only change the angle, and the green above comes out about as bright as the blue.
The color space can also describe colors outside the classic sRGB range, so on a wide gamut screen a high chroma value can look more vivid than any hex code.
That is also the caveat. Not every combination exists on every screen, and a chroma that is too high for a given lightness gets mapped back into the display’s range, so two of your shades may end up looking the same. Keep chroma moderate for UI colors. Browser support is broad: Chrome 111, Firefox 113 and Safari 15.4.
Further reading: MDN: oklch()