Review Request 126720: Adds QML's PlasmaCore.SVG CustomColor feature

Marco Martin notmart at gmail.com
Mon Jan 11 21:50:58 UTC 2016



> On Jan. 11, 2016, 7:12 p.m., Marco Martin wrote:
> > I would do it the following way:
> > CustomColorScheme *customColorScheme() const;
> > 
> > 
> > class CustomColorScheme : public QObject {
> >     Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
> >     QColor textColor()
> >     QColor BackgroundColor()
> >     ..etc..
> > }
> > 
> > It would be a bit less flexible than having custom selectors, limited to the few "standard" named colors but all would have nice bindable properties.
> > then the final stylesheet would be built based from this
> > 
> > 
> > 
> > how does it sound?
> 
> Nico Rodsevich wrote:
>     I think that restriction would difficult the writing of the SVG:
>     In addition to the not recommended use of the semantic behaviour, suppose you want to fully use the whole system colors palette in the .svg, where would the new colors be included?
>     However I think this would be a great feature in the ColorScope object

The colors would be those exposed by Theme (that are a subset of KColorGroup)

 Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChangedProxy)

    Q_PROPERTY(QColor complementaryTextColor READ complementaryTextColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor complementaryBackgroundColor READ complementaryBackgroundColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor complementaryHoverColor READ viewHoverColor NOTIFY themeChangedProxy)
    Q_PROPERTY(QColor complementaryFocusColor READ viewFocusColor NOTIFY themeChangedProxy)

I would eventually add (both to Theme and this) the positive/neutral/negative colors usually associate with green/orange/red


the stylesheet in the curreent svgs is at the moment this (I was thinking more of just selectively replacing the color of one or more those classes from the code, being c++ or qml)

.ColorScheme-Text {
        color:#31363b;
      }
      .ColorScheme-Background {
        color:#eff0f1;
      }
      .ColorScheme-Highlight {
        color:#3daee9;
      }
      .ColorScheme-ViewText {
        color:#31363b;
      }
      .ColorScheme-ViewBackground {
        color:#fcfcfc;
      }
      .ColorScheme-ViewHover {
        color:#93cee9;
      }
      .ColorScheme-ViewFocus{
        color:#3daee9;
      }
      .ColorScheme-ButtonText {
        color:#31363b;
      }
      .ColorScheme-ButtonBackground {
        color:#eff0f1;
      }
      .ColorScheme-ButtonHover {
        color:#93cee9;
      }
      .ColorScheme-ButtonFocus{
        color:#3daee9;
      }

Then if a plasmoid for some reason needs a completely different hardcoded color, the qml can still set backgroundColor: #ff2343 or
whatever to the svg.


- Marco


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126720/#review90929
-----------------------------------------------------------


On Jan. 11, 2016, 9:37 p.m., Nico Rodsevich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126720/
> -----------------------------------------------------------
> 
> (Updated Jan. 11, 2016, 9:37 p.m.)
> 
> 
> Review request for Plasma, David Edmundson and Marco Martin.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> Enables to set rules that extends the #current-color-scheme CSS style of the Svg in order to change the Svg's items with currentColor fill to the specified in the customColors rules
> 
> 
> Diffs
> -----
> 
>   src/plasma/private/svg_p.h 1d1000d 
>   src/plasma/svg.h 3a4ca1d 
>   src/plasma/svg.cpp 28abd00 
> 
> Diff: https://git.reviewboard.kde.org/r/126720/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Nico Rodsevich
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160111/4837e5b9/attachment.html>


More information about the Plasma-devel mailing list