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

Color Enhancements #200

Merged
merged 37 commits into from
May 4, 2020
Merged

Color Enhancements #200

merged 37 commits into from
May 4, 2020

Conversation

clarkmoody
Copy link
Contributor

@clarkmoody clarkmoody commented Feb 21, 2020

A few enhancements to the color functionality. Adds the palette feature flag that adds dependency and tie-in to the palette color management library.

Might wait for a significant change in palette to land before proceeding.

Color

  • Validation of RGBA values. Limit to [0,1]
  • Inversion
  • Convert to/from palette's Srgba type

Example App

  • Simple example app that dynamically generates a color palette based on your input color

Screen Shot 2020-04-27 at 4 28 12 PM

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! I shared some of my thoughts. Let me know what you think.

core/src/color.rs Outdated Show resolved Hide resolved
core/src/color.rs Show resolved Hide resolved
core/src/color.rs Show resolved Hide resolved
@manokara
Copy link

Wouldn't palette make more sense for the feature flag since it just enables color conversions through the library? I think naming it colors gives off the idea that color management in general is optional.

@clarkmoody
Copy link
Contributor Author

@manokara Renamed in 2e463fe

core/src/color.rs Outdated Show resolved Hide resolved
core/src/color.rs Outdated Show resolved Hide resolved
@hecrj hecrj added feature New feature or request improvement An internal improvement labels Apr 2, 2020
@Ogeon
Copy link

Ogeon commented Apr 5, 2020

Hey! I noticed the mentioning of my PR and just want to drop by and say that it's already possible to have conversion automatically derived in version 0.5. That includes two way conversion and From and Into. Just have a look at FromColor and IntoColor. The third example, with CssRgb, should be close to your use case.

The changes in 0.6 will make that feature more flexible, remove derived From and Into because of incompatibility, and also add automatic clamping after converting. Not to mention unlocking future improvements. But this only matters if you would implement FromColor and IntoColor. Otherwise you don't have to worry about it or wait for 0.6. 🙂

It's cool to see Palette being integrated like this and Iced is a really interesting project! Let me know if you have any questions or requests for how to make things smoother. 😁

@clarkmoody clarkmoody marked this pull request as ready for review April 21, 2020 19:14
@clarkmoody
Copy link
Contributor Author

Ready for review here

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! The example is really cool.

I have shared some ideas to improve the code here and there. We are close to merging this!

core/src/color.rs Show resolved Hide resolved
core/src/lib.rs Outdated Show resolved Hide resolved
examples/color_palette/Cargo.toml Outdated Show resolved Hide resolved
examples/color_palette/src/main.rs Outdated Show resolved Hide resolved
examples/color_palette/src/main.rs Outdated Show resolved Hide resolved
examples/color_palette/src/main.rs Outdated Show resolved Hide resolved
@hecrj hecrj added this to the 0.2.0 milestone Apr 23, 2020
@clarkmoody
Copy link
Contributor Author

Very cool changes @hecrj!

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

As many different colors do not play well with GIF compression, I have added a static screenshot instead of an animated GIF in the example README. The image links to an animated Gfycat, like most of the other examples.

I think this ship is ready to sail! Thank you for all the work and the great example :D

@hecrj hecrj merged commit 27aad74 into iced-rs:master May 4, 2020
@clarkmoody
Copy link
Contributor Author

Aww yeah :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request improvement An internal improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants