-
Notifications
You must be signed in to change notification settings - Fork 143
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
Examples: Replace Color::from_* and Color::new with palette::css where possible #787
base: main
Are you sure you want to change the base?
Conversation
I stumbled onto this by trying to copy the example code into my own project, but discovered it does not compile with the vello version on crates.io. I assume that is a known problem? If so, this is an unfortunate barrier for newcomers :( |
Clippy failed because the import is only used behind the |
Thanks for this! To use the
Hmm, I'm unsure how this change would have an impact there - the palettes used would also not be available on the release on crates.io.
I think that's right. It's the solution we used to import |
How did you find these matching colours? Were they all identical to the CSS counterpart? (if the colours have changed, the snapshot tests will need to be updated) |
Oh, I did not realize the exact values of the example colours mattered for tests, so I just chose the ones from the css list, which matches most closely... |
This change won´t help. I was just making sure, that the issue is known! Mentioning this in the README seems like a good idea, since many people (me included) learn a new crate by adapting it's examples. |
How are the snapshot tests generated? Since they will need to be updated. |
You should use |
Ah, that is what i feared. Some test pass on my machine with the modified colors (due to the leniency in the tests) and are therefore not updated, but since this introduces baseline error into each test, they now are much more sensitive, so are failing on i.e. macos. |
As mentioned in #749, this replaces all uses of
Color::from_*
andColor::new
withpalette::css
constants when possible.This also allowed me to remove the import of
peniko::Color
, in all but one example project.I do not know how to use the
examples/scenes
lib, so it is technically untested, but I tried to match the colors as best as possible, which should be good enough.