Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Specify accent colors as MaterialColor constants #151

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Apr 21, 2022

Move the material color generation logic out to a separate helper tool
to be able to specify the accent colors as MaterialColor constants and
to get rid of the extra "fooMaterialColor" variables that were exposed
by the library.

Move the material color generation logic out to a separate helper tool
to be able to specify the accent colors as MaterialColor constants and
to get rid of the extra "fooMaterialColor" variables that were exposed
by the library.
@Feichtmeier
Copy link
Member

Thank you this is much cooler!

@Feichtmeier Feichtmeier merged commit abfdaee into ubuntu:main Apr 21, 2022
@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

I was kind of testing the waters here to see the reaction. 😄 I'd love to try to make use of even more compile-time constants if possible. Compile-time constants not only provide better performance but can be used as default arguments too, for example. Non-constants have an unfortunate snowball effect that any code referencing them cannot be constants either.

@jpnurmi jpnurmi deleted the accent-colors branch April 21, 2022 09:30
@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

@Feichtmeier Are any other colors, such as the flavor colors, using similar logic or are the values chosen by hand?

@Feichtmeier
Copy link
Member

Feichtmeier commented Apr 21, 2022

@jpnurmi the flavor versions (if used at all) are just for the sake of being a complete ubuntu theme. They could be created in the same way ofc if you prefer! It is kind of a mish mash currently

Edit: ehhh sorry for the weird answer. The flavor colors are generated colors by some online tool I used (forgotten which one)
https://github.com/ubuntu/yaru.dart/blob/main/lib/src/colors/flavor_colors.dart
I mean, if your new tooling is reliant enough why not get rid of the flavor colors file ? :) Those material colors are a very cool idea for safe themes, but are a bit annoying to use because you need to create all shades. With your tooling it is a lot less painful

@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

The colors generated by https://material.io/inline-tools/color/ look a bit different. It has something more sophisticated under the hood. What do you think about these?

yaru.dart material.io
Screenshot from 2022-04-21 17-51-53 Screenshot from 2022-04-21 17-52-09

@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

Oh, and it dynamically calculates the shade of the primary value too - not assumed 500. For orange and bark, it's 600, whereas olive is 800.

@Feichtmeier
Copy link
Member

The colors generated by https://material.io/inline-tools/color/ look a bit different. It has something more sophisticated under the hood. What do you think about these?

yaru.dart material.io
Screenshot from 2022-04-21 17-51-53 Screenshot from 2022-04-21 17-52-09

If this wouldn't change the shade500 colours and the contrast improves overall sounds good

@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

If this wouldn't change the shade500 colours and the contrast improves overall sounds good

With these colors, the primary shade is not always 500. It depends on the brightness of the primary value.

@Feichtmeier
Copy link
Member

If this wouldn't change the shade500 colours and the contrast improves overall sounds good

With these colors, the primary shade is not always 500. It depends on the brightness of the primary value.

Ah! Okay sorry. Yes I meant if the primary colour doesn't change

@jpnurmi
Copy link
Member Author

jpnurmi commented Apr 21, 2022

Ok, I'll take a closer look at the color tool algorithm.

@Feichtmeier Feichtmeier mentioned this pull request May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants