New for Rgb undefined?


Documentation says that, to create a Rgb pixel from numerical values, the old from_channels is deprecated. The compiler agrees. It's supposedly been replaced by new. But "new" doesn't work, and there's no sign of it in the code near from_channels. Did that get left out?

This is a link to the playground in general, not to the specific example. You might want to click "Share" button at the top right copy the generated link from there.

This is a mistake in documentation - Rgba (and Rgb) doesn't define any new method indeed, but it is not necessary, since their only field is public. Therefore, just Rgb([r, g, b]) should work.

1 Like


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.