For some time now, maybe two years, I’ve wanted support for high-contrast color schemes in KDE Plasma.
Technically, it was already possibleBy simply modifying your color scheme to such colors. However one thing was missing: the outline was calculated automatically with hardcoded values.
Well, not anymore! Now you can set your own frame contrast values! And you may ask “Why don’t the colors change completely?” Which is a good question and I’ll answer it later.
This feature will be in Plasma 6.6. hopefully. Or if you use KDE Linux you may have tried it already. ,
settings
The settings will look like this.
This setting used to be a slider… and guess what it did Nothing In Breeze style. This was left over from the times of oxygen. However if you use the Oxygen style, don’t worry, the slider value is just a percentage now and will be converted to the value used by Oxygen.
desktop example
Some examples of what this might look like in a desktop setting.
All items are updated to follow this:
- QtQuick Windows (qqc2-desktop-style)
- QtWidgets style and decoration (Breeze)
- Plasma SVG files (using anything
class: ColorScheme-Frame,
There are still some bugs including panels not always updating immediately, although we are working on fixing them.
Why didn’t the entire color change?
Currently across all our apps and genres, we do the following:
- Take background color and foreground color
- Combine them with the framecontrast value previously hardcoded, which was 0.2
- Use that as the color for all frames
If we want it to be completely colorable, we have to go through every single incident
Of this color mixture. Most apps fortunately rely on styling, but some may have custom things to do, for example custom QtQuick controls that do this manually using Kirigami.Theme.frameContrast
price.
I think we could probably get away with this for most apps, but then the rest of them would look wrong, and some of them might not even be KDE apps, but using Kirigami.. so we’d have to tell everyone to do this update, otherwise things would risk looking broken.
This was the compromise solution: Allow users to change Kirigami.Theme.frameContrast They value whatever they want, even putting it off. ,
too much work
This was a lot of work. In total, it was 8 merge requests that had to work together and merge in the right order, etc.
And this is why it is so hard to modify Breeze in our current stack. You’ll have to make many changes to the entire platform.. and make sure nothing breaks in the process!
My first draft: use KDGlobals
The first step for me was to try making it a global configuration value only ~/.config/kdeglobalsWhich each platform will look for modifications to this particular price.
This worked fine, but it was quite messy, and I had to make sure all the default values in the stack were in sync. This is annoying for those who want to modify the default value later. Also, I felt like constantly checking the config file for different platform changes is not a good idea.
Second draft: Use KColorScheme
After talking to people, we decided it would be best to add it as a new value to our KColorScheme library. Instead of all platforms looking for this configuration change, only the KColorScheme library did so.
This helped me simplify the implementation considerably.
Summary of changes
Overall, I had to do the following:
- This value is set to kdeglobals/current colorcheme | Update KColorScheme to load from Add
- Update settings for plasma-workspaces to allow users to change this value. Add
- Update the Breeze window decoration and QtWidgets style to use this value. Add
- Update the Kirigami PlatformTheme to notify any platforms that use it of the changes.
- Update the libplasma library to actually listen to changes in this contrast value and make changes accordingly. Add
- Update qqc2-desktop-style (QtQuick style) to listen for changes in this value and make changes accordingly. Add
- Update the KSvg library to now use plasma styles
ColorScheme-FrameClass to load the correct color. Add - Update kde-gtk-config to ensure that the Breeze GTK theme also updates correctly when the value is changed.
Yes. This is a lot. It took me about a week to work on it.
One week to make a number user convertible.
Now imagine how much time it would have taken if I had made the entire color variable!
And remember, there’s a lot of legacy code here that depends on each other, so I can’t possibly take shortcuts in places without breaking everything.
And hence the union was born
This is why the Union is such an important project when it comes to styling, and why we’re not going to modify the Breeze too much other than for maintenance: even small changes are a lot of work.
The Union provides us with a “single source of truth”. We can only change things from within a place And (hopefully) see visual updates everywhere, whether it’s QtQuick, QtWidgets or Plasma styles or whatever else we decide to support! Which means it’s easier to work on styling and iterate on it, it’s easier for designers to collaborate because changes don’t take days… etc.
That’s why I’m putting more effort into the union from now on.
Summary and future
I felt this was an important change for accessibility reasons, so I made it. And I’m glad I did, even though it was a lot of work. (And there’s still more to come with bug fixing.) This will also help reduce issues where people feel our apps are too “unstable”. Now you can turn them off (well, you can make their color the same as the background color) by setting the Contrast to 0%. I must warn you that the value has to be set to 0% will probably appear broken in some placesSo we’ll probably have to add a warning in the color editor saying “hey this isn’t optimal but you can do it, hahaha.”
In the short-term future, I’d like to see this added to the desktop portal interface for high-contrast accessibility priority: when a user has enabled it, whether they’re on a Plasma desktop or not, applications will automatically maximize this frame contrast value.
And then, there’s bug hunting and finding any strange anomalies. If you see any, please report them at https://bugs.kde.org!
In the long run, this whole colorful thing will be rewritten into something stronger, brighter, brighter and it will work with the Union and everything will be nice and beautiful. At least, I hope so.
I hope people will like this feature, especially those who need high-contrast colors.
Thanks for reading.