Some of your users may suffer from vision problems, e.g., color blindness or a very high myopia.
To be sure to offer an accessible experience to them, you must comply with the WCAG (Web Content Accessibility Guidelines).
Provide alternative text (Alt Text) for your image. Alternative text is displayed in place of the image if the technical conditions do not enable the image to be displayed. But above all, this alternative text is read by screen reader software for disabled persons. For blind users, it can also be converted into braille.
Make sure colors used for your image generate a sufficient contrast, e.g., a 4.5:1 contrast level is required to comply with the level AA of the WCAG standard.
Do not only rely on colors to convey ideas.