https://bugs.kde.org/show_bug.cgi?id=504998

            Bug ID: 504998
           Summary: Support Titlebar and Other Colours in CSS Styling from
                    ColourTheme
    Classification: Frameworks and Libraries
           Product: frameworks-ksvg
      Version First unspecified
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: General
          Assignee: plasma-b...@kde.org
          Reporter: stellarpo...@googlemail.com
  Target Milestone: ---

SUMMARY

I was looking to implement customising an aurorae theme using the current
titlebar colour. I had a specific usecase, but from google, it seems it is a
repeatedly-asked question, if it's possible to customise accent colours for
window decorations on a per-application basis.

In my system settings, the colour themes support various properties, including
specific ones for the titlebar text and background, in additopon to the more
general button.text colours. After going down a few rabbitholes in Aurorae, and
form the documentation
[here](https://develop.kde.org/docs/plasma/aurorae/#package-structure) on
Aurorae themes, and the linked page
[here](https://develop.kde.org/docs/plasma/theme/theme-colors/#system-colors)
on using colour theme variables within Plasma, it seems that the first blocker
is that the KSVG doesn't expose all of the colours that are available in the
theme files.

I can get my decorations to use one of the system colours by adding CSS styles
to the aurorae SVG as in the link above like so:
```CSS
      .ColorScheme-Highlight
      {
          color:#ff3cef; /* plceholder that will be replaced by the KSVG engine
*/
      }

      .ColorScheme-ActiveTitlebar {
          color:#ff3cef; /* plceholder that will be replaced by the KSVG engine
*/
      }
    </style>
    <path 
```

However here, using Highlight renders okay; trying to use the titlebar colours
does not. That makes sense as [this
enum](https://invent.kde.org/frameworks/ksvg/-/blob/917abf3e057fb83e1384a0f2b53e641fbe4ffaa1/src/ksvg/svg.h#L167
) (this may not be the canonical/correct location, just using Gitlab's search
function) doesn't list anything referencing titlebars. I can only assume that
themes implemented in code, such as breeze, are accessing a colour theme class
directly, and so sidestep this issue and thus support custom titlebar colours,
or else it;s handled differently in KWin somewhere.

Whilst for general-purpose theming of SVGs (which it would seem KSVG does,
being modular), using the titlebar colours in those files might be a bit of an
abuse, I'd like to ask if people owuld ocnsider it appropriate to expose them,
as I think the possibilities it opoens up with Aurorae would be quite
significant. Aurorae supports themes in native code, QML, and SVG, althogh the
SVG form has more limited support - yet from what I can find is by a long shot
the format most used by designers and theme authors. To implement what I am
looking to do, I could mangle something using a different element in the theme,
but the titlebar colour is purposed exactly for that, and there would be other
side-effects in how the window contents are drawn, so it makes sense to me that
Aurorae should have access to it when working with SVGs.

The colour theme is also exposed by the KWin Scripting API, so having access to
this property in a theme would allow scripts and addons to set window
decoration colours dynamically, assigning different colours to windows based on
application class or state, where currently it is limited to shading,
active/inactive, etc. And a few changes ot Aurorae might be needed (haven;t
investigated that fully yet), but in either case it should then be as simple as
using the new styles in the SVGs for a theme and having any dynamic behaviour
propagate through automatically to theme SVGs that are aware of these colours.

So seems like a quick change and I oculd open an FR on invent when I have time,
but thought I should raise the question first in case there would be objections
or repercussions.

Cheers




EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to