import numpy

# RGB in 0..1; YCbCr in 8-bit space
RGB_to_YCbCr = numpy.array([
    [  65.481, 128.553,  24.966,  16],
    [ -37.797, -74.203, 112.000, 128],
    [ 112.000, -93.786, -18.214, 128],
    [       0,       0,       0,    1],
])

# white, yellow, cyan, green, magenta, red, blue, black
Rs = [255, 255,   0,   0, 255, 255,   0, 0]
Gs = [255, 255, 255, 255,   0,   0,   0, 0]
Bs = [255,   0, 255,   0, 255,   0, 255, 0]

for R, G, B in zip(Rs, Gs, Bs):
    Y, Cb, Cr, _ = RGB_to_YCbCr @ [R / 255, G / 255, B / 255, 1]
    print(f"{int(round(Y)):>3} {int(round(Cb - 128)):>4} {int(round(Cr - 128)):>4}")