Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a convinence macro to create a color from a hex code / const function with comptime error #13079

Open
A-Walrus opened this issue Apr 23, 2024 · 1 comment
Labels
C-Feature A new feature, making something new possible S-Blocked This cannot move forward until something else changes

Comments

@A-Walrus
Copy link
Contributor

A-Walrus commented Apr 23, 2024

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

Creating a color from a hex code. Alternative to having Color::hex("...").unwrap() (or Srgba::hex("...").unwrap())

What solution would you like?

Either:

  • A macro to create a color from a hex code without unwraps, compile error if color is invalid.
  • A const function with a compiletime error on invalid color, no need to unwrap

Not sure how this fits in with the new color overhaul :P

What alternative(s) have you considered?

Leave it as is.

@A-Walrus A-Walrus added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Apr 23, 2024
@A-Walrus A-Walrus changed the title Add a convinence macro to create a color from a hex code Add a convinence macro to create a color from a hex code / const function with comptime error Apr 23, 2024
@bushrat011899
Copy link
Contributor

I believe the best solution to his problem, a const fn, is blocked by RFC #911. Once const float operations are permitted, I imagine almost the entire bevy_color crate could then by marked const.

@bushrat011899 bushrat011899 added S-Blocked This cannot move forward until something else changes and removed S-Needs-Triage This issue needs to be labelled labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Feature A new feature, making something new possible S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

No branches or pull requests

2 participants