diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp
index 07e555e8b7..ecf8b61df0 100644
--- a/modules/highgui/src/window_QT.cpp
+++ b/modules/highgui/src/window_QT.cpp
@@ -3084,25 +3084,38 @@ void DefaultViewPort::drawStatusBar()
// if (mouseCoordinate.x()>=0 && mouseCoordinate.y()>=0)
{
QRgb rgbValue = image2Draw_qt.pixel(mouseCoordinate);
+ const QPalette colorPalette{ QApplication::palette(this) };
- if (nbChannelOriginImage==CV_8UC3 )
+ const QColor normalTextColor = colorPalette.brush(QPalette::WindowText).color();
+ const QString textColorName = normalTextColor.name();
+
+
+ if (nbChannelOriginImage==CV_8UC3)
{
- centralWidget->myStatusBar_msg->setText(tr("(x=%1, y=%2) ~ ")
+ const int r_half = normalTextColor.red() >> 1;
+ const int g_half = normalTextColor.green() >> 1;
+ const int b_half = normalTextColor.blue() >> 1;
+ const QColor red = QColor(255, g_half, b_half);
+ const QColor green = QColor(r_half, 255, b_half);
+ const QColor blue = QColor(r_half, g_half, 255);
+ centralWidget->myStatusBar_msg->setText(tr("(x=%2, y=%3) ~ ")
+ .arg(textColorName)
.arg(mouseCoordinate.x())
.arg(mouseCoordinate.y())+
- tr("R:%3 ").arg(qRed(rgbValue))+//.arg(value.val[0])+
- tr("G:%4 ").arg(qGreen(rgbValue))+//.arg(value.val[1])+
- tr("B:%5").arg(qBlue(rgbValue))//.arg(value.val[2])
+ tr("R:%5 ").arg(red.name()).arg(qRed(rgbValue))+
+ tr("G:%7 ").arg(green.name()).arg(qGreen(rgbValue))+
+ tr("B:%9").arg(blue.name()).arg(qBlue(rgbValue))
);
}
if (nbChannelOriginImage==CV_8UC1)
{
//all the channel have the same value (because of cv::cvtColor(GRAY=>RGB)), so only the r channel is dsplayed
- centralWidget->myStatusBar_msg->setText(tr("(x=%1, y=%2) ~ ")
+ centralWidget->myStatusBar_msg->setText(tr("(x=%2, y=%3) ~ ")
+ .arg(textColorName)
.arg(mouseCoordinate.x())
.arg(mouseCoordinate.y())+
- tr("L:%3 ").arg(qRed(rgbValue))
+ tr("L:%4 ").arg(qRed(rgbValue))
);
}
}