Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] Fix KernelShark appearance on dark color schemes
@ 2019-10-10 21:24 Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 1/4] kernel-shark: Set text color to black in KsDualMarker's QLabels Mikhail Rudenko
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-10 21:24 UTC (permalink / raw)
  To: linux-trace-devel
  Cc: Steven Rostedt, Yordan Karadzhov (VMware), Mikhail Rudenko

Currently a few widgets in Kernel Shark UI use custom stylesheets,
unconditionally setting their background or text color (but not both!)
to hard-coded values. This has a side effect of widget text being
poorly readable on some color schemes (e.g. Breeze Dark, and dark
schemes in general). This patch series tries to address this issue.

The first three patches are trivial: they ensure that whenever the
background color of a widget is set to white via stylesheet, its text
color is set to black.

The fourth one changes "inactive" marker selection button style to
system default, making it look clickable on all color schemes.

Mikhail Rudenko (4):
  kernel-shark: Set text color to black in KsDualMarker's QLabels
  kernel-shark: Set text color to black in pointer position QLabel
  kernel-shark: Set text color to black in KsTraceGraph's axes labels
  kernel-shark: Change KsDualMarker's inactive button style to default

 kernel-shark/src/KsDualMarker.cpp | 11 ++---------
 kernel-shark/src/KsTraceGraph.cpp |  6 ++++--
 2 files changed, 6 insertions(+), 11 deletions(-)

--
2.23.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] kernel-shark: Set text color to black in KsDualMarker's QLabels
  2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
@ 2019-10-10 21:24 ` Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 2/4] kernel-shark: Set text color to black in pointer position QLabel Mikhail Rudenko
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-10 21:24 UTC (permalink / raw)
  To: linux-trace-devel
  Cc: Steven Rostedt, Yordan Karadzhov (VMware), Mikhail Rudenko

At present, background color of marker position QLabels is forced to
white with a stylesheet, but the text color stays unchanged. As a
result, the text is barely visible when using dark color schemes. This
patch forces the text color to black for these QLabels, making it
readable on all color schemes.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 kernel-shark/src/KsDualMarker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel-shark/src/KsDualMarker.cpp b/kernel-shark/src/KsDualMarker.cpp
index 755e246..0070777 100644
--- a/kernel-shark/src/KsDualMarker.cpp
+++ b/kernel-shark/src/KsDualMarker.cpp
@@ -156,7 +156,7 @@ KsDualMarkerSM::KsDualMarkerSM(QWidget *parent)

 	for (auto const &l: {&_labelMA, &_labelMB, &_labelDelta}) {
 		l->setFrameStyle(QFrame::Panel | QFrame::Sunken);
-		l->setStyleSheet("QLabel {background-color : white;}");
+		l->setStyleSheet("QLabel {background-color : white; color : black}");
 		l->setTextInteractionFlags(Qt::TextSelectableByMouse);
 		l->setFixedWidth(FONT_WIDTH * 16);
 	}
--
2.23.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/4] kernel-shark: Set text color to black in pointer position QLabel
  2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 1/4] kernel-shark: Set text color to black in KsDualMarker's QLabels Mikhail Rudenko
@ 2019-10-10 21:24 ` Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 3/4] kernel-shark: Set text color to black in KsTraceGraph's axes labels Mikhail Rudenko
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-10 21:24 UTC (permalink / raw)
  To: linux-trace-devel
  Cc: Steven Rostedt, Yordan Karadzhov (VMware), Mikhail Rudenko

At present, the background color of the pointer position QLabel is
forced to white with a stylesheet, but the text color stays
unchanged. As a result, the text is barely visible when using dark
color schemes. This patch forces the text color to black for this
QLabel, making it readable on all color schemes.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 kernel-shark/src/KsTraceGraph.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel-shark/src/KsTraceGraph.cpp b/kernel-shark/src/KsTraceGraph.cpp
index 2e48372..73e7577 100644
--- a/kernel-shark/src/KsTraceGraph.cpp
+++ b/kernel-shark/src/KsTraceGraph.cpp
@@ -62,7 +62,7 @@ KsTraceGraph::KsTraceGraph(QWidget *parent)

 	_pointerBar.addWidget(&_labelP1);
 	_labelP2.setFrameStyle(QFrame::Panel | QFrame::Sunken);
-	_labelP2.setStyleSheet("QLabel { background-color : white;}");
+	_labelP2.setStyleSheet("QLabel { background-color : white; color: black}");
 	_labelP2.setTextInteractionFlags(Qt::TextSelectableByMouse);
 	_labelP2.setFixedWidth(FONT_WIDTH * 16);
 	_pointerBar.addWidget(&_labelP2);
--
2.23.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/4] kernel-shark: Set text color to black in KsTraceGraph's axes labels
  2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 1/4] kernel-shark: Set text color to black in KsDualMarker's QLabels Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 2/4] kernel-shark: Set text color to black in pointer position QLabel Mikhail Rudenko
@ 2019-10-10 21:24 ` Mikhail Rudenko
  2019-10-10 21:24 ` [PATCH 4/4] kernel-shark: Change KsDualMarker's inactive button style to default Mikhail Rudenko
  2019-10-10 22:02 ` [PATCH 0/4] Fix KernelShark appearance on dark color schemes Steven Rostedt
  4 siblings, 0 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-10 21:24 UTC (permalink / raw)
  To: linux-trace-devel
  Cc: Steven Rostedt, Yordan Karadzhov (VMware), Mikhail Rudenko

At present, background color of axes labels of the plot is forced to
white with a stylesheet, but the text color stays unchanged. As a
result, text is barely visible when using dark color schemes. This
patch forces the text color to black for these labels, making them
readable on all color schemes.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 kernel-shark/src/KsTraceGraph.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel-shark/src/KsTraceGraph.cpp b/kernel-shark/src/KsTraceGraph.cpp
index 73e7577..90f83f3 100644
--- a/kernel-shark/src/KsTraceGraph.cpp
+++ b/kernel-shark/src/KsTraceGraph.cpp
@@ -96,6 +96,8 @@ KsTraceGraph::KsTraceGraph(QWidget *parent)
 	_legendAxisX.layout()->addWidget(&_labelXMin);
 	_legendAxisX.layout()->addWidget(&_labelXMid);
 	_legendAxisX.layout()->addWidget(&_labelXMax);
+	_legendAxisX.setStyleSheet("QLabel { background-color : white; color: black}");
+
 	_drawWindow.setMinimumSize(100, 100);
 	_drawWindow.setStyleSheet("QWidget {background-color : white;}");

@@ -580,7 +582,7 @@ void KsTraceGraph::_updateGraphLegends()
 			width = STRING_WIDTH(graphName);

 		name->setAlignment(Qt::AlignBottom);
-		name->setStyleSheet("QLabel {background-color : white;}");
+		name->setStyleSheet("QLabel {background-color : white; color : black}");
 		name->setFixedHeight(KS_GRAPH_HEIGHT);
 		layout->addWidget(name);
 	};
--
2.23.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] kernel-shark: Change KsDualMarker's inactive button style to default
  2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
                   ` (2 preceding siblings ...)
  2019-10-10 21:24 ` [PATCH 3/4] kernel-shark: Set text color to black in KsTraceGraph's axes labels Mikhail Rudenko
@ 2019-10-10 21:24 ` Mikhail Rudenko
  2019-10-10 22:02 ` [PATCH 0/4] Fix KernelShark appearance on dark color schemes Steven Rostedt
  4 siblings, 0 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-10 21:24 UTC (permalink / raw)
  To: linux-trace-devel
  Cc: Steven Rostedt, Yordan Karadzhov (VMware), Mikhail Rudenko

At present, the style of an "inactive" KsDualMarker toolbar button is
set to "system default background + rgb(70,70,70) text color". As a
result, on dark qt color schemes (e.g. Breeze Dark) inactive button
looks disabled ("gray on gray").

This patch addresses the issue by changing "inactive" button style to
system default. This makes the UI intuitive across different color
schemes.

QStateMachine::setGlobalRestorePolicy is used for reducing the
boilerplate of manually resetting button style when it becomes
"inactive".

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 kernel-shark/src/KsDualMarker.cpp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/kernel-shark/src/KsDualMarker.cpp b/kernel-shark/src/KsDualMarker.cpp
index 0070777..90c5373 100644
--- a/kernel-shark/src/KsDualMarker.cpp
+++ b/kernel-shark/src/KsDualMarker.cpp
@@ -171,20 +171,12 @@ KsDualMarkerSM::KsDualMarkerSM(QWidget *parent)
 				"styleSheet",
 				styleSheetA);

-	_stateA->assignProperty(&_buttonB,
-				"styleSheet",
-				"color : rgb(70, 70, 70)");
-
 	styleSheetB = "background : " +
 		      _markB._color.name() +
 		      "; color : white";

 	_stateB = new QState;
 	_stateB->setObjectName("B");
-	_stateB->assignProperty(&_buttonA,
-				"styleSheet",
-				"color : rgb(70, 70, 70)");
-
 	_stateB->assignProperty(&_buttonB,
 				"styleSheet",
 				styleSheetB);
@@ -223,6 +215,7 @@ KsDualMarkerSM::KsDualMarkerSM(QWidget *parent)
 	connect(&_buttonA,	&KsMarkerButton::deselect,
 		this,		&KsDualMarkerSM::deselectA);

+	_machine.setGlobalRestorePolicy(QState::RestoreProperties);
 	_machine.addState(_stateA);
 	_machine.addState(_stateB);
 	_machine.setInitialState(_stateA);
--
2.23.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] Fix KernelShark appearance on dark color schemes
  2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
                   ` (3 preceding siblings ...)
  2019-10-10 21:24 ` [PATCH 4/4] kernel-shark: Change KsDualMarker's inactive button style to default Mikhail Rudenko
@ 2019-10-10 22:02 ` Steven Rostedt
  2019-10-11 14:11   ` Yordan Karadzhov (VMware)
  4 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2019-10-10 22:02 UTC (permalink / raw)
  To: Mikhail Rudenko
  Cc: linux-trace-devel, Steven Rostedt, Yordan Karadzhov (VMware)

On Fri, 11 Oct 2019 00:24:25 +0300
Mikhail Rudenko <mike.rudenko@gmail.com> wrote:

> Currently a few widgets in Kernel Shark UI use custom stylesheets,
> unconditionally setting their background or text color (but not both!)
> to hard-coded values. This has a side effect of widget text being
> poorly readable on some color schemes (e.g. Breeze Dark, and dark
> schemes in general). This patch series tries to address this issue.
> 
> The first three patches are trivial: they ensure that whenever the
> background color of a widget is set to white via stylesheet, its text
> color is set to black.
> 
> The fourth one changes "inactive" marker selection button style to
> system default, making it look clickable on all color schemes.
> 
> Mikhail Rudenko (4):
>   kernel-shark: Set text color to black in KsDualMarker's QLabels
>   kernel-shark: Set text color to black in pointer position QLabel
>   kernel-shark: Set text color to black in KsTraceGraph's axes labels
>   kernel-shark: Change KsDualMarker's inactive button style to default
> 
>  kernel-shark/src/KsDualMarker.cpp | 11 ++---------
>  kernel-shark/src/KsTraceGraph.cpp |  6 ++++--
>  2 files changed, 6 insertions(+), 11 deletions(-)


Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Yordan,

If you are fine with these patches, could you pull them in and push
them to the repo?

-- Steve


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] Fix KernelShark appearance on dark color schemes
  2019-10-10 22:02 ` [PATCH 0/4] Fix KernelShark appearance on dark color schemes Steven Rostedt
@ 2019-10-11 14:11   ` Yordan Karadzhov (VMware)
  2019-10-11 18:18     ` Mikhail Rudenko
  0 siblings, 1 reply; 8+ messages in thread
From: Yordan Karadzhov (VMware) @ 2019-10-11 14:11 UTC (permalink / raw)
  To: Steven Rostedt, Mikhail Rudenko; +Cc: linux-trace-devel, Steven Rostedt



On 11.10.19 г. 1:02 ч., Steven Rostedt wrote:
> On Fri, 11 Oct 2019 00:24:25 +0300
> Mikhail Rudenko <mike.rudenko@gmail.com> wrote:
> 
>> Currently a few widgets in Kernel Shark UI use custom stylesheets,
>> unconditionally setting their background or text color (but not both!)
>> to hard-coded values. This has a side effect of widget text being
>> poorly readable on some color schemes (e.g. Breeze Dark, and dark
>> schemes in general). This patch series tries to address this issue.
>>
>> The first three patches are trivial: they ensure that whenever the
>> background color of a widget is set to white via stylesheet, its text
>> color is set to black.
>>
>> The fourth one changes "inactive" marker selection button style to
>> system default, making it look clickable on all color schemes.
>>
>> Mikhail Rudenko (4):
>>    kernel-shark: Set text color to black in KsDualMarker's QLabels
>>    kernel-shark: Set text color to black in pointer position QLabel
>>    kernel-shark: Set text color to black in KsTraceGraph's axes labels
>>    kernel-shark: Change KsDualMarker's inactive button style to default
>>
>>   kernel-shark/src/KsDualMarker.cpp | 11 ++---------
>>   kernel-shark/src/KsTraceGraph.cpp |  6 ++++--
>>   2 files changed, 6 insertions(+), 11 deletions(-)
> 
> 
> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 
> Yordan,
> 
> If you are fine with these patches, could you pull them in and push
> them to the repo?

Hi Mikhail,

Thanks a lot!
I am pushing the patches.
Is is possible to send us a screenshot? I am curious to see how 
KernelShark looks on your dark color scheme.

cheers,
Yordan

> 
> -- Steve
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] Fix KernelShark appearance on dark color schemes
  2019-10-11 14:11   ` Yordan Karadzhov (VMware)
@ 2019-10-11 18:18     ` Mikhail Rudenko
  0 siblings, 0 replies; 8+ messages in thread
From: Mikhail Rudenko @ 2019-10-11 18:18 UTC (permalink / raw)
  To: Yordan Karadzhov \(VMware\); +Cc: Steven Rostedt, linux-trace-devel

On 2019-10-11 at 17:11 MSK, Yordan Karadzhov (VMware):

> Hi Mikhail,
>
> Thanks a lot!
> I am pushing the patches.
> Is is possible to send us a screenshot? I am curious to see how
> KernelShark looks on your dark color scheme.

You're welcome!

Here are the screenshots with and without the patches applied:
https://imgur.com/a/MyXdiEN

Best regards,
Mikhail

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 21:24 [PATCH 0/4] Fix KernelShark appearance on dark color schemes Mikhail Rudenko
2019-10-10 21:24 ` [PATCH 1/4] kernel-shark: Set text color to black in KsDualMarker's QLabels Mikhail Rudenko
2019-10-10 21:24 ` [PATCH 2/4] kernel-shark: Set text color to black in pointer position QLabel Mikhail Rudenko
2019-10-10 21:24 ` [PATCH 3/4] kernel-shark: Set text color to black in KsTraceGraph's axes labels Mikhail Rudenko
2019-10-10 21:24 ` [PATCH 4/4] kernel-shark: Change KsDualMarker's inactive button style to default Mikhail Rudenko
2019-10-10 22:02 ` [PATCH 0/4] Fix KernelShark appearance on dark color schemes Steven Rostedt
2019-10-11 14:11   ` Yordan Karadzhov (VMware)
2019-10-11 18:18     ` Mikhail Rudenko

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git