As far as I understand the documentation, the RGB color space being used by both this package and ColorTypes.jl is the sRGB color space. I do not understand whether a specific YCbCr color space is being used by this package, i.e. it's not clear if YCbCr values in this package represent colors according to Rec. 601, Rec. 709, or perhaps none of the above. However, it seems that converting between sRGB and YCbCr requires a specific YCbCr color space.
It seems that the code in this package that converts between sRGB and YCbCr uses coefficients to convert between Rec. 601 YCbCr and RGB values in that same color space. However, sRGB uses the color primaries of Rec. 709, not Rec. 601. The same wikipedia page I linked to above mentions that in this case, people often use Rec. 709 color space when converting between sRGB and YCbCr, producing YCbCr values in the Rec. 709 color space.
It seems that if my understanding that Colors.jl uses RGB values in the sRGB color space is right, then this conversion is wrong. The fix may be simple: if the input color space is sRGB, and the output color space is YCbCr values in the Rec. 709 color space, then it's simply a matter of changing the coefficients.
Either way I think it would be helpful to document which YCbCr color space is used by Colors.jl. Even if the RGB and YCbCr values could just be different ways of representing colors in any color space, being able to convert one into the other (I think) requires a defined color space for each.
As far as I understand the documentation, the RGB color space being used by both this package and ColorTypes.jl is the sRGB color space. I do not understand whether a specific YCbCr color space is being used by this package, i.e. it's not clear if YCbCr values in this package represent colors according to Rec. 601, Rec. 709, or perhaps none of the above. However, it seems that converting between sRGB and YCbCr requires a specific YCbCr color space.
It seems that the code in this package that converts between sRGB and YCbCr uses coefficients to convert between Rec. 601 YCbCr and RGB values in that same color space. However, sRGB uses the color primaries of Rec. 709, not Rec. 601. The same wikipedia page I linked to above mentions that in this case, people often use Rec. 709 color space when converting between sRGB and YCbCr, producing YCbCr values in the Rec. 709 color space.
It seems that if my understanding that Colors.jl uses RGB values in the sRGB color space is right, then this conversion is wrong. The fix may be simple: if the input color space is sRGB, and the output color space is YCbCr values in the Rec. 709 color space, then it's simply a matter of changing the coefficients.
Either way I think it would be helpful to document which YCbCr color space is used by Colors.jl. Even if the RGB and YCbCr values could just be different ways of representing colors in any color space, being able to convert one into the other (I think) requires a defined color space for each.