From f84d8043d8f9ce6eae32869c5290ac6ec4883464 Mon Sep 17 00:00:00 2001 From: hasherezade Date: Tue, 5 Jan 2021 14:11:55 +0100 Subject: [PATCH] [BUGFIX] Fixed address hilighting in dark mode (Issue #14) --- ifl.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ifl.py b/ifl.py index 80fa868..ba2bd49 100644 --- a/ifl.py +++ b/ifl.py @@ -587,18 +587,19 @@ def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole) -> Any: # -------------------------------------------------------------------------- # custom views: - -COLOR_NORMAL = 0xFFFFFF - - class FunctionsView_t(QtWidgets.QTableView): """The top view: listing all the functions. """ # private + def _get_default_color(self) -> None: + ea = idaapi.get_screen_ea() + seg = idaapi.getseg(ea) + return seg.color + def _set_segment_color(self, ea, color) -> None: seg = idaapi.getseg(ea) - seg.color = COLOR_NORMAL + seg.color = color seg.update() # public @@ -606,6 +607,7 @@ def __init__(self, dataManager, color_hilight, func_model, parent=None) -> None: super(FunctionsView_t, self).__init__(parent=parent) self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) # + self.color_normal = self._get_default_color() self.prev_addr = BADADDR self.color_hilight = color_hilight self.func_model = func_model @@ -622,11 +624,11 @@ def currentChanged(self, current, previous) -> None: def hilight_addr(self, addr: int) -> None: if self.prev_addr != BADADDR: ea = self.prev_addr - self._set_segment_color(ea, COLOR_NORMAL) - set_color(ea, CIC_ITEM, COLOR_NORMAL) + self._set_segment_color(ea, self.color_normal) + set_color(ea, CIC_ITEM, self.color_normal) if addr != BADADDR: ea = addr - self._set_segment_color(ea, COLOR_NORMAL) + self._set_segment_color(ea, self.color_normal) set_color(addr, CIC_ITEM, self.color_hilight) self.prev_addr = addr