bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add a `Gray` color trait

Open alice-i-cecile opened this issue 1 year ago • 3 comments

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

Creating uniformly gray colors is a common task for prototyping and even some finished UIs.

Doing so is currently tedious and doesn't show intent well. Rather than Srgba::gray(0.9), users must type Srgba::rgb(0.9, 0.9, 0.9).

What solution would you like?

Add an extension trait for the color spaces that support the creation of grey colors, and use that.

What alternative(s) have you considered?

Using the clearly superior but not style-guide approved Canadian spelling of Grey.

Additional context

Our examples use grays a ton: these could be cleaned up as part of the same PR.

alice-i-cecile avatar May 03 '24 16:05 alice-i-cecile

I'll take a whack at this.

Earthmark avatar May 04 '24 18:05 Earthmark

This came up when drafting the PR, but is the goal with this interface to have a specific input value (say grey(0.5)), to mean the same color in every color format?

~~I implemented a linear traversal of the color values, not so much the color space. I can adapt the code as needed though!~~ EDIT: It now uses mix instead, which I think deals with traversing the color space appropriately.

Earthmark avatar May 04 '24 20:05 Earthmark

I don't think gray should mean the same color in every format. Using mix between the black and the whitepoint of the space is what I would expect.

Also Color probably shouldn't implement this (pointing this out only because we just added a bunch of extra methods to it.

NthTensor avatar May 10 '24 01:05 NthTensor

@alice-i-cecile I think this issue should be closed due to merge commit

bugsweeper avatar May 27 '24 10:05 bugsweeper