Σελίδες

Saturday 16 February 2019

Latte and a Colors tale...

https://phabricator.kde.org/source/latte-dock/


A few months ago while I was scratching Latte Dock limits an idea came and haunted my thoughts. How Latte could give the colors freedom for panels and windows that an Android phone already provides? Questions like this arose and solutions appeared suddenly in many different places, but an important and concrete dream prevail in the end.


“Lets have panels and docks that understand their environment and adjust their colors and settings accordingly”


- youtube presentation -


How far would we like this dream to go, what are the limits?

An initial effort was landed at v0.8 through the Dynamic Background options but of course it was very limited. Step by step with patience the following goals appeared after version 0.8

Panels that:
  • can understand the underlying background independent of screen
  • color themselves according to the underlying background in order to provide the best contrast when they are transparent
  • can understand busy backgrounds (elementary style) in order to provide enough contrast
  • solidify themselves at some circumstances
  • understand when a window is touching them and paint themselves based on that window colors
  • can choose to be light or dark but at the same time to be based on the current plasma theme
  • provide an easy and elegant way to support the above features

Someone could ask, What nice features to have in my system but how long do you think it will be needed to provide them? one, two years?  who knows maybe never…

Well the thing is that this article does not describe the future but rather the PRESENT… All the above are currently supported from Latte git version. With their limits of course that arose from the current technology but nonetheless they are here…



What is needed in my system?




Appearance
(advanced settings)
How can I enable these features in Latte git version?


After you install above requirements you can find these features at Latte Appearance settings. Latte Advanced settings has been reorganized and improved in order to provide you with a full screen height window at the edge of the screen. The new settings moto is:


“easy to find, simple to understand”


the settings work has not ended yet so more improvements will be presented in the future.












How can Latte understand which is the underlying background?


Latte tracks the plasma config files and discovers for each screen what is the current background used. It can understand only background image files or single colors. For each one it produces a brightness value for each different edge and at the same time if the background in that edge is busy. That means that a bottom dock can be light and a top panel can be dark in order for both to be presented correctly to the user. The same of course applies to different screens because screens can have backgrounds with different brightness.

In case you are using a gif animator or video playing for your background and the brightness is not identified correctly you could try the following. Make a representing screenshot from the mentioned video and assign that image as a background. You can afterwards reenable your background video because Latte will use that screenshot to identify the different brightness values for the edges.




Can a plasma theme choose to be dark or light dynamically?

Materia dark theme
in Latte Reversed Colors mode
Well the answer is by default it can not. Each plasma theme can be either light or dark and that is an important decision from its designer. Latte did not want to break the designer style so in order to solve this is trying the following.

Latte understands if a plasma theme is dark or light and independent of that it creates a reversed color palette. For example the background color will become the text color and the text color will become the background color. This way the colors used do not look too different.

At the same time in order for Latte to paint correctly a reversed colored background the plasma theme panel roundness needs to be known (how rounded are the panels in the corners). Latte already provides a file that describes the panels roundness for the most known plasma themes but if the theme does not exist in the file or the user just wants to bypass it he can adjust the plasma roundness in pixels through the Latte Preferences window.




How Latte can know what is the color scheme for each window?

The earlier mentioned KWin script sends through dbus the color schemes for windows that do not use the default applied color scheme. When these messages reach Latte are filed and thus Latte whenever needs to, can provide a proper color palette to be consumed by panels and applets.





What are the limits?


The new coloring mechanism needs to be supported from applets in order to be painted correctly at all cases. Currently there are four applets supporting it, Latte taskmanager, Window Title, Window AppMenu and Window Buttons . For the rest the user must choose whether the colorize effect should be applied or not. For example the plasma analog clock that is not monochromatic it should not be painted at all cases. The new option to disable the painting can be found at applet tooltip in edit mode.


left: analog clock with no painting / center: analog clock with painting / right: tooltip to disable painting



Epilogue

That is all for now, I hope you enjoy these new features, personally I love them...




Donations

You can find Latte at Liberapay if you want to support,     Donate using Liberapay


or you can split your donation between my active projects in kde store.