- Add upstream patches from master to improve appearance of color picker:
* 0001-Color-Picker-Add-border-around-color-if-contrast-to-.patch * 0002-Color-Picker-Add-contrast-frame-around-colors-in-pop.patch OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-addons?expand=0&rev=127
This commit is contained in:
parent
0d4b91d911
commit
1b80c461d7
@ -0,0 +1,57 @@
|
||||
From ef3fd95a32572c20b8e8e407b45726be4a95bcfd Mon Sep 17 00:00:00 2001
|
||||
From: Kai Uwe Broulik <kde@privat.broulik.de>
|
||||
Date: Thu, 26 Jan 2017 16:21:09 +0100
|
||||
Subject: [PATCH 1/2] [Color Picker] Add border around color if contrast to
|
||||
surrounding view is too little
|
||||
|
||||
When picking a light color on a light panel, it might not be obvious that the color is shown there.
|
||||
Add a border around the picked color if contrast is too little.
|
||||
|
||||
Differential Revision: https://phabricator.kde.org/D4224
|
||||
---
|
||||
applets/colorpicker/package/contents/ui/main.qml | 29 ++++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/applets/colorpicker/package/contents/ui/main.qml b/applets/colorpicker/package/contents/ui/main.qml
|
||||
index b45d00486..845391cd8 100644
|
||||
--- a/applets/colorpicker/package/contents/ui/main.qml
|
||||
+++ b/applets/colorpicker/package/contents/ui/main.qml
|
||||
@@ -189,6 +189,35 @@ Item {
|
||||
height: units.roundToIconSize(pickerIcon.height) * 0.75
|
||||
radius: width / 2
|
||||
color: root.recentColor
|
||||
+
|
||||
+ function luminance(color) {
|
||||
+ if (!color) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // formula for luminance according to https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
||||
+
|
||||
+ var a = [color.r, color.g, color.b].map(function (v) {
|
||||
+ return (v <= 0.03928) ? v / 12.92 :
|
||||
+ Math.pow( ((v + 0.055) / 1.055), 2.4 );
|
||||
+ });
|
||||
+
|
||||
+ return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
||||
+ }
|
||||
+
|
||||
+ border {
|
||||
+ color: theme.textColor
|
||||
+ width: {
|
||||
+ var contrast = luminance(theme.viewBackgroundColor) / luminance(colorCircle.color) + 0.05;
|
||||
+
|
||||
+ // show border only if there's too little contrast to the surrounding view
|
||||
+ if (contrast > 3) {
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ return Math.round(Math.max(units.devicePixelRatio, width / 20));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 75fd9dda750c6bc192e56ed16d34a0920bdf41df Mon Sep 17 00:00:00 2001
|
||||
From: Kai Uwe Broulik <kde@privat.broulik.de>
|
||||
Date: Thu, 26 Jan 2017 16:59:48 +0100
|
||||
Subject: [PATCH 2/2] [Color Picker] Add contrast frame around colors in popup
|
||||
|
||||
This adds a frame around the color sections, makes it look a lot nicer and improves contrast.
|
||||
|
||||
Since here the frame takes only a minor portion of surface area compared to the circle in a panel,
|
||||
I opted not to base it on luminosity, also for consistency's sake when there's 9 different colors in one view.
|
||||
|
||||
Differential Revision: https://phabricator.kde.org/D4298
|
||||
---
|
||||
applets/colorpicker/package/contents/ui/main.qml | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/applets/colorpicker/package/contents/ui/main.qml b/applets/colorpicker/package/contents/ui/main.qml
|
||||
index 845391cd8..ba1920a0c 100644
|
||||
--- a/applets/colorpicker/package/contents/ui/main.qml
|
||||
+++ b/applets/colorpicker/package/contents/ui/main.qml
|
||||
@@ -318,9 +318,18 @@ Item {
|
||||
|
||||
color: delegateMouse.currentColor
|
||||
|
||||
+ border {
|
||||
+ color: theme.textColor
|
||||
+ width: Math.round(units.devicePixelRatio)
|
||||
+ }
|
||||
+
|
||||
Rectangle {
|
||||
- anchors.bottom: parent.bottom
|
||||
- width: parent.width
|
||||
+ anchors {
|
||||
+ bottom: parent.bottom
|
||||
+ left: parent.left
|
||||
+ right: parent.right
|
||||
+ margins: rect.border.width
|
||||
+ }
|
||||
height: colorLabel.contentHeight + 2 * units.smallSpacing
|
||||
color: theme.backgroundColor
|
||||
opacity: 0.8
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Jan 28 09:54:36 UTC 2017 - fabian@ritter-vogt.de
|
||||
|
||||
- Add upstream patches from master to improve appearance of color picker:
|
||||
* 0001-Color-Picker-Add-border-around-color-if-contrast-to-.patch
|
||||
* 0002-Color-Picker-Add-contrast-frame-around-colors-in-pop.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 26 19:58:55 CET 2017 - fabian@ritter-vogt.de
|
||||
|
||||
|
@ -29,6 +29,10 @@ License: LGPL-2.1 and GPL-2.0+ and GPL-3.0
|
||||
Group: System/GUI/KDE
|
||||
Url: http://www.kde.org/
|
||||
Source: kdeplasma-addons-%{version}.tar.xz
|
||||
# PATCH-FIX-UPSTREAM 0001-Color-Picker-Add-border-around-color-if-contrast-to-.patch kde@privat.broulik.de -- [Color Picker] Add border around color if contrast to surrounding view is too little
|
||||
Patch200: 0001-Color-Picker-Add-border-around-color-if-contrast-to-.patch
|
||||
# PATCH-FIX-UPSTREAM 0002-Color-Picker-Add-contrast-frame-around-colors-in-pop.patch kde@privat.broulik.de -- [Color Picker] Add contrast frame around colors in popup
|
||||
Patch201: 0002-Color-Picker-Add-contrast-frame-around-colors-in-pop.patch
|
||||
BuildRequires: kf5-filesystem
|
||||
BuildRequires: cmake(KF5Activities) >= 5.25.0
|
||||
BuildRequires: cmake(KF5Config) >= 5.25.0
|
||||
@ -78,6 +82,8 @@ Additional plasmoids from upstream for use on the Plasma workspace.
|
||||
%lang_package
|
||||
%prep
|
||||
%setup -q -n kdeplasma-addons-%{version}
|
||||
%patch200 -p1
|
||||
%patch201 -p1
|
||||
|
||||
%build
|
||||
%cmake_kf5 -d build -- -DCMAKE_INSTALL_LOCALEDIR=%{_kf5_localedir}
|
||||
|
Loading…
x
Reference in New Issue
Block a user