theming questions

Marco Martin notmart at gmail.com
Wed Jan 13 14:26:13 GMT 2021


On Wed, Dec 23, 2020 at 8:06 PM Dirk Hohndel <dirk at hohndel.org> wrote:
>
>
> Hi there and happy holidays
>
> I'm trying to improve the theming of my Kirigami-based app. We started using Kirigami about 5 years ago (before the current Theme code was there) and have done a lot of rather brute force things along the way (mostly out of incompetence and impatience, TBH).
> Additionally, while Kirigami appears to think of theming mostly as "let's fit into whatever desktop theme is used", we want to offer the user the ability to switch between different color schemes at run time (and then of course remember their choice).
> As a result we have our own "ThemeInterface" object that we instantiate from QML and use to grab the theme colors. Of course that clashes with the way Kirigami does theming. We have a few hacks to the Kirigami code (hooray for open source libraries), but I'm trying to move away from those and find ways to utilize the existing Kirigami theming more.
> And that's where I'm running into what I guess are understanding issues with the code.
>
> Here's how I think Kirigami theming works.
> There's an attached property that shows up on every QML object. The Theme property offers background, text, highlight colors, and interestingly a colorSet that allows for different color combination for Windows, Buttons, modal things, etc.
> All great and logical (I think).
>
> Now let's assume you want to change those colors. The documentation advises against that, but also shows how to do that.

Hi Dirk,
there may be several ways to go about.
As Nico says, the Theme cal actually load plugins which can make it
arbitrarly customizable.
I was thinking about ways to make apps use arbitrary own color schemes
(mostly for mobile use case) didn't come to a good upstream solution
yet (i guess will end up have something based upon plain text config
files for different color themes).
you can do either a c++ theme specialization plugin, or if you use
your own style, and have it as a subdirectory in styles/
you can then provide your own Theme.qml that exposes the various color
properties (just start from one existing)
so then in there you can make those values conditional to your internal theme.
there it should affect colors everywhere (handles included).
I assume is for Subsurface, right? i see that it already has custom
buttons and whatnot, if they are a QtQuickcontrols2 theme, just create
a kirigami style with the same name and that should be used

-- 
Marco Martin


More information about the Plasma-devel mailing list