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

more “on” colors #4929

Merged
merged 16 commits into from
Jun 18, 2024
Merged

more “on” colors #4929

merged 16 commits into from
Jun 18, 2024

Conversation

toaster
Copy link
Member

@toaster toaster commented Jun 12, 2024

Description:

This PR adds additional “on” colors for the “error”, “warning” and “success” colors.

Later, these will be used to improve the contrast on buttons or other widgets using these colors.

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

…rning and success

While the label uses this color for foreground, the button uses it for
background.
This keeps the color values compactly grouped at a single place.
It might also prevent useless allocations because the compiler probably
cannot optimize here.
These might diverge to improve the contrast.
…ning

Besides “primary” these are the colors used to express different
importance levels. To achieve a reasonable contrast, the color to paint
on these (or to paint these on) might be different to the default
foreground (or background) color.
The new “on” colors are introduced with the foreground value but
probably change, soon.
The production theme is not guaranteed to use unique color values and
therefore is not reliable to create correct markup renderings.
Formerly, the theme’s background color was used and therefore the
“onError” color was changed to the background color value to make this
a seamless change.
Formerly, the theme’s background color was used and therefore the
“onSuccess” color was changed to the background color value to make this
a seamless change.

This includes a “success button” in the Fyne demo app.
Formerly, the theme’s background color was used and therefore the
“onWarning” color was changed to the background color value to make this
a seamless change.
@toaster toaster changed the base branch from master to develop June 12, 2024 09:30
@coveralls
Copy link

Coverage Status

coverage: 65.738% (+0.2%) from 65.57%
when pulling 019a4cb on toaster:feature/on_colors
into 389162b on fyne-io:develop.

theme/color.go Outdated
// ColorNameOnSuccess is the name of theme lookup for a contrast color to the success color.
//
// Since: 2.5
ColorNameOnSuccess fyne.ThemeColorName = "onSuccess"
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit sceptical to the "On" naming (applies to the colour we already have?). It clashes a bit too much with the namning we have for callbacks in my opinion. Can we not call it something like ColorNameContrastSuccess or similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the naming approach (the color to be used on some other color) and don’t think that it clashes with names in a completely different field (event handling).

Copy link
Member

Choose a reason for hiding this comment

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

I really do think it sounds as if "ColorNameOnSuccess" is a colour that in some way "happens" when something succeeds. If it is a contrasting colour to it, I'd prefer to mention contrast in the name. Do you have any thoughts on it @dweymouth?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Jacob - I find the "on" names a little confusing. But maybe prefixing the color names with "Foreground" would work? eg:
ColorNameForegroundOnSuccess fyne.ThemeColorName = "foregroundOnSuccess"

That would:

  • Make it clear that these "on" colors are variants of the foreground color, not the success color (in this example)
  • Make the naming clash with events less confusing as those names all begin with On

I also think though with the feature freeze this should wait until 2.6 to go in

Copy link
Member

Choose a reason for hiding this comment

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

We already have one "On" colour in and we need to decide on what to do here (but yeah, I do agree on this waiting for 2.6). ColorNameForegroundOnSuccess is a big improvement. There is still room for confusion though. Maybe we can use "Over" or "Above" instead of "On" in that case? Or tie in contrast in some way?

Copy link
Member

Choose a reason for hiding this comment

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

We should get agreement on this before the new "OnPrimary" is landed in the coming release!

Copy link
Member Author

Choose a reason for hiding this comment

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

I just implemented my suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dweymouth @Jacalz would you go with this recent commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added some minor fixes, so the commit I was referring to is 9de5027.

Copy link
Member

Choose a reason for hiding this comment

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

Seems good to me. I'm happy

@coveralls
Copy link

Coverage Status

coverage: 65.888% (+0.3%) from 65.57%
when pulling 9de5027 on toaster:feature/on_colors
into 389162b on fyne-io:develop.

This color used the wrong constant because it had already the same value
as the background color when the constant for that one was introduced
in 47bf464.
@coveralls
Copy link

Coverage Status

coverage: 65.869% (+0.3%) from 65.57%
when pulling ceb9fc8 on toaster:feature/on_colors
into 389162b on fyne-io:develop.

Jacalz
Jacalz previously approved these changes Jun 17, 2024
Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

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

Big contrast improvements. Nice!

Jacalz
Jacalz previously approved these changes Jun 18, 2024
@coveralls
Copy link

Coverage Status

coverage: 65.861% (+0.2%) from 65.686%
when pulling b1d56de on toaster:feature/on_colors
into 759df6f on fyne-io:develop.

@toaster toaster merged commit 0dce57d into fyne-io:develop Jun 18, 2024
12 checks passed
@toaster toaster deleted the feature/on_colors branch June 18, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants