Skip to content

Commit

Permalink
make history graph look well in dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Oct 5, 2021
1 parent 4edccb8 commit 5f166b6
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions kart/gui/historyviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@
from qgis.gui import QgsMessageBar

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt, QPoint, QRectF, QDateTime
from qgis.PyQt.QtGui import QIcon, QPixmap, QPainter, QColor, QPainterPath, QPen
from qgis.PyQt.QtCore import (
Qt,
QPoint,
QRectF,
QDateTime,
)
from qgis.PyQt.QtGui import (
QIcon,
QPixmap,
QPainter,
QColor,
QPainterPath,
QPen,
QPalette,
)

from qgis.PyQt.QtWidgets import (
QTreeWidget,
Expand Down Expand Up @@ -277,7 +290,10 @@ def populate(self):
def graphImage(self, commit, width):
image = QPixmap(width, COMMIT_GRAPH_HEIGHT).toImage()
qp = QPainter(image)
qp.fillRect(QRectF(0, 0, width, COMMIT_GRAPH_HEIGHT), Qt.white)
palette = QWidget().palette()
qp.fillRect(
QRectF(0, 0, width, COMMIT_GRAPH_HEIGHT), palette.color(QPalette.Base)
)

path = QPainterPath()
for col in commit["graph"][0][r"\|"]:
Expand Down Expand Up @@ -310,7 +326,7 @@ def graphImage(self, commit, width):
path.lineTo(x2, COMMIT_GRAPH_HEIGHT)
pen = QPen()
pen.setWidth(PEN_WIDTH)
pen.setBrush(QColor(Qt.black))
pen.setBrush(palette.color(QPalette.WindowText))
qp.setPen(pen)
qp.drawPath(path)

Expand Down

0 comments on commit 5f166b6

Please sign in to comment.