As CK1 says, getting a darker variant of a colour using HSB/HSV and HSL (Hue, Saturation, Brightness/Value or Lightness) scales is easy. Reduce the variable that corresponds to brightness, lightness or value. In both HSL and HSV, that takes you straight down towards black, keeping the same hue and saturation. (HSB is basically the same as HSV)
Image source
In RGB scales (and remember that both RGB and CMYK colours can be manipulated using HSB/HSL), it's also pretty easy. Reduce the amount of Red,Green, and Blue by the same relative amount - resulting in less light but the same ratio between each type of light. If you think of it like a 3D cube where Red,Green,Blue each have a dimension...
Image source
...you can think of it as simply moving in a straight line from wherever your colour is in the cube, towards the black corner (0 Red, 0 Green, 0 Blue), away from the white corner (255 Red, 255 Green, 255 Blue).
Hex codes are just RGB values written in Hexadecimal format. The first two characters after the # are Red, then Blue, then Green. Hexadecimal means counting in base 16, which looks like this:
00=zero
01=one
...
09=nine
0A=ten
0B=eleven
...
0E=fourteen
0F=fifteen
10=sixteen
11=seventeen
...
1A=twenty six
1B=twenty seven
...
FE=two hundred and fifty four
FF=two hundred and fifty five
The internet is full of formulas and snippets of code to convert hexadecimals to regular (base-ten) numbers.