Skip to content

Do not require a BackgroundColor for UI images #11157

@pablo-lua

Description

@pablo-lua

What problem does this solve or what need does it fill?

Actually, in order to use an image with Sprite or even UiImage, you are forced to use a BackgroundColor that is different from transparent, and that is misleading, can lead to one to think "well, I don't want an color in my Image, so I'll set it to transparent, right?" and then being confused because the image disappeared

What solution would you like?

The BackgroundColor, when being used with an image would apply an oppacity of determined color above the image. For example Rgb(255, 255, 0, 0.5) would taint the image slightly of yellow
but if one use Rgb(0, 0, 0, 1) the image would be tainted of black and the image itself would disappear (as alpha is 100%), leaving an black square on its place

What alternative(s) have you considered?

For that purpose, probably adding an child or something above the child with the desired color and leaving color in the background as Color::WHITE and leaving it as it is.

Additional context

  • A possible problem that would appear from this is if one wants to make a image appear only a little, with alpha set to for example 0.5, that wouldn't be possible for that approach, and a possible solution to this is adding another component that specifies the Image oppacity

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions