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

Improve gtk accent colour palette #3486

Closed

Conversation

lyubomir-popov
Copy link
Contributor

@lyubomir-popov lyubomir-popov commented Mar 15, 2022

  • Introduce an improved colour palette: 8 colours that comply with accessibility contrast ratio requirements:
  • Remove scss transformations on accent colours, as they are not needed (the proposed colours are carefully selected to work with both light and dark themes)
  • Small refactor to separate the light and dark theme. Instead of inline if statements for every colour, 2 blocks of code - one for the light theme, one for the dark theme. This will make it easier to audit them and work on them independantly.

In the image below, the numbers inside colour swatches show that the minimum required contrast ratios from the WCAG spec are met:

  • Text under 14px requires a minimum of 4.5:1
  • Graphical elements and text above 14px/bold requires a minimum of 3:1

image

Below a list of screenshots of all proposed colours in both the light and the dark themes:

image
image
image
image
image
image
image
image
image
image
image
image
image
image

@lyubomir-popov lyubomir-popov changed the title Improved gtk accent colour palette Improve gtk accent colour palette Mar 15, 2022
@Jupi007
Copy link
Member

Jupi007 commented Mar 15, 2022

Hi @lyubomir-popov,
all those color are nice, but I see two problem with the refactoring of _colors:

  • you define the vars name three times, and so the file is three times bigger and it add a lot of duplication ;
  • and we aim to be as close as possible to upstream file and this modification totally break this rule.

So except if you think this change is really needed, can you revert this file to it's original look please 🙂

@3v1n0
Copy link
Contributor

3v1n0 commented Mar 15, 2022

@Jupi007 yeah, we discussed already about that together and I think we'll revert that.

In case we can add a yaru-colors.scss file with overrides as we do in gtk4 IIRC

Muqtxdir and others added 26 commits March 15, 2022 21:43
- added various colors from elementary's stylesheet as placeholder.
It makes it easier to maintain and handle in diffs
…es to use

Make meson to re-use default theme thdefinitions and assets when a theme
doesn't provide a specific version for it.

As per this we can avoid having multiple symlinks but just ensuring
that we always prefer theme-specific files, and in case they don't exist
we fallback to the same theme variant or to the default theme.

As per this, we can avoid lots of duplication and symlinks that are not
easiest to maintain.

One note on sassc: it will now include multiple paths from where to pick
a specific included resource.
Note that if "@include 'fooo'" is used in a sym-linked resource it will
try to load that from the parent folder of the sym-link target resides.
So, we still need to preserve some symlinks otherwise sassc will just
try to load everything from the target folder.

In case a file needs to be overridden by a theme, ensure that it's going
to be loaded (`strace` is your friend).
Use some scss magic to create accent color themes without having us to
re-create or re-define all the themes.

We use an accent-colors scss file as entry point that may define the
yaru variables for accent colors and then we load the standard themes.

In case such variables are defined, the accents are set.
Depending on the theme we want to use we may need to load different
assets, so replace the "url" function so that we can dynamically update
the returned value depending on the theme.
- Also improved the 2-shade gradient by making it a 12-shade gradient of black and white for folders and user-desktop.
@lyubomir-popov
Copy link
Contributor Author

lyubomir-popov commented Mar 16, 2022

@Jupi007 Yes, as @3v1n0 said we agreed to revert it, I'll push an update to my pr.

As for my reasons to initially go this way - doing any extensive theming work with hundreds of inline ifs would be quite difficult.
There are many issues that I noticed but fall outside the scope of this accent colour work - like the fact that noone knows how many different greys are currently in use. Or the fact that the hover in one widget (menu for example) is a different shade of grey form another widget (settings side nav). This happens because everything uses magic numbers in lighten(), transparentize(), etc.

Ideally those should be defined in one control file, and anotated - so if you come looking for a hover grey, you know where to look to find it, or change it across all widgets.

So I still think it's a good idea to pitch this refactor upstream, but not something that has to happen now by any means.

Regarding the duplication - it only increases the file size of the scss, not the generated css, and I think that's a small price to pay for being able to introduce some level of consistency.

@Jupi007
Copy link
Member

Jupi007 commented Mar 16, 2022

@lyubomir-popov Okay, thanks for the explanation.

Honestly, Gtk3 is very stable since a while.
We do not plan to do more tweaks, and upstream didn't do any stylesheet update since a while.
We'd like to let Gtk3 die quietly and peacefully, that's why heavy modifications are now imo useless :)

@lyubomir-popov
Copy link
Contributor Author

We'd like to let Gtk3 die quietly and peacefully, that's why heavy modifications are now imo useless :)

Didn't know that, thanks for the additional context. Makes sense to leave it be then.
That said, the above applies to whatever theming mechanism succeeds it.

@lyubomir-popov
Copy link
Contributor Author

@3v1n0 I've updated the colour names and restored the _colors.scss. I've removed some color transformations that I think are unnecessary. Please have a look and let me know if you need anything else.

(I've also added fancier colour names like viridian, olive, bark)

@Muqtxdir
Copy link
Member

@lyubomir-popov are the new-color codes final? asking because I'll change the colors offered in the settings appearance panel and in what order should they be presented ? (Currently for context the order is Orange (default), Aqua, Blue, Green, Pink, Purple, Red, Yellow)

@lyubomir-popov
Copy link
Contributor Author

lyubomir-popov commented Mar 16, 2022

@Muqtxdir yes, they are final. The order should be as in the scss file - they are ordered by hue, from the default ubuntu orange on the left to the red on the right:

image
N.B.: I've noticed some differences between the colour in the code and the colour displayed in the dots. For example, the hex code of the ubuntu orange is: E95420; when I measure the colour of the orange dot, I get:
image
Could you please remove any color transforms e.g. lighten, transparentize, etc.

@Muqtxdir
Copy link
Member

thanks for the clarification @lyubomir-popov I'll remove any transformations on the orange selector and arrange all the colors as you've suggested based on the hue.

Feichtmeier added a commit to ubuntu/archive_yaru.dart that referenced this pull request Mar 16, 2022
@3v1n0 3v1n0 force-pushed the gtk_accent_colors branch 7 times, most recently from f0bbc11 to 6b822ee Compare March 17, 2022 18:15
@3v1n0
Copy link
Contributor

3v1n0 commented Mar 17, 2022

Closing this as it has been merged in the branch that is part of #3416

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.

4 participants