introduce Custom color set
ClosedPublic

Authored by mart on May 31 2018, 9:54 AM.

Details

Summary

In some scenarios, some applications need certain areas with completely custom
palettes, for instance if a piece of ui is on top of an image it may make
sense that hierarchy uses whatever the dominant colors of such image are.
in the scenario of a Custom color set, the qml code would look like this:
Item {

Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Custom
Kirigami.Theme.textColor: "#af2352"
Kirigami.Theme.backgroundColor: "#124523"
...

}

Test Plan

piece with a custom set in the gallery

Diff Detail

Repository
R169 Kirigami
Branch
mart/customColors
Lint
No Linters Available
Unit
No Unit Test Coverage
mart created this revision.May 31 2018, 9:54 AM
Restricted Application added a project: Kirigami. · View Herald TranscriptMay 31 2018, 9:54 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart requested review of this revision.May 31 2018, 9:54 AM
mart added a comment.EditedMay 31 2018, 9:55 AM

note that some pieces of breeze controls can't have a custom color as breeze uses kcolorscheme directly for them, so they can only be read from kdeglobals (mouseover effect for buttons doesn't work as well in the current colors kcm preview for this reason)

mart edited the summary of this revision. (Show Details)May 31 2018, 9:57 AM
mart added a reviewer: broulik.
broulik added inline comments.Jun 1 2018, 9:59 AM
src/kirigamiplugin.cpp
172 ↗(On Diff #35517)

What's this?

src/libkirigami/basictheme.cpp
133

Probably prints warnings for themes that don't have this?

src/libkirigami/platformtheme.cpp
314 ↗(On Diff #35243)

Can this lead to issues with non-deterministic setting of properties? Ie. say Kirigami.Theme.textColor is evaluated before Kirigami.Theme.colorSet: Kirigami.Theme.Custom?

src/libkirigami/platformtheme.h
79

Do they need a RESET?

237

Where is this used?

mart added inline comments.Jun 4 2018, 11:28 AM
src/kirigamiplugin.cpp
172 ↗(On Diff #35517)

gah, sorry, remains of old attempts

src/libkirigami/platformtheme.cpp
314 ↗(On Diff #35243)

it would work fine, as writing to color properties always works...
which is a thing i don't like much, but either properties are writable or not.
if one writes the proeprties with another colorset, it would "partly" work, then all the customizations go away as soon as one of the implementations does a syncColors(), which is not pretty.

the only thing i can think about to make it work in a more predictable way is:

duplicate every setter, with setCustomTextColor etc (so setTextColor to be used only by implementations), and store all the custom colors in different members, then textColor() would be return colorSet == custom ? d->customTextColor : d->textColor

(then a reset method could be implemented

src/libkirigami/platformtheme.h
79

perhaps... i wouldn't know how to implement one with the current architecture
(see the other comment for an idea)

237

crap, another remain of old approach :)

mart updated this revision to Diff 35516.Jun 4 2018, 11:55 AM
  • remove dead code
This revision was not accepted when it landed; it landed in state Needs Review.Jun 4 2018, 11:59 AM
Closed by commit R169:bf90602e90ea: remove dead code (authored by mart). · Explain Why
This revision was automatically updated to reflect the committed changes.
mart reopened this revision.Jun 4 2018, 1:07 PM
mart updated this revision to Diff 35612.Jun 5 2018, 12:04 PM
  • confised prototype for custom colors handling
  • coloroverrides has approach
  • add missing file
  • another route: Custom color set
  • propagate all colors
  • export a palette in the basictheme
  • propagate colors to material
  • all colors writeable
  • remove dead code
  • use customColors copy properties
  • possible to have spinboxes on new line
  • make color propagation work for material
mart edited the summary of this revision. (Show Details)Jun 5 2018, 12:05 PM

D13233 not necassary anymore

This revision was not accepted when it landed; it landed in state Needs Review.Jun 6 2018, 10:24 AM
This revision was automatically updated to reflect the committed changes.