Skip to content

Commit

Permalink
Add basic console colors
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitris Zervas <[email protected]>
  • Loading branch information
dzervas committed Jan 12, 2024
1 parent 3a3bdf3 commit 941a98a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion console.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

ICONS_PATH = PLUGIN_PATH / "icons"

CSS = f"""
a {{ text-decoration: none; }}
a[href^="function"] {{ color: {ui.getThemeColor(bn.ThemeColor.CodeSymbolColor).name()}; }}
a[href^="address"] {{ color: {ui.getThemeColor(bn.ThemeColor.AddressColor).name()}; }}
"""

def on_anchor_click(url: QUrl):
bv: bn.BinaryView = ui.UIContext.activeContext().getCurrentView().getData()

Expand Down Expand Up @@ -114,7 +120,7 @@ def appendHtml(self: QTextBrowser, html: str):
return

self.moveCursor(QTextCursor.End)
self.insertHtml("<br/>" + html)
self.insertHtml(f"<style>{CSS}</style><br/>{html}")
self.moveCursor(QTextCursor.End)
setattr(self.output, "appendHtml", appendHtml.__get__(self.output, QTextBrowser))

Expand Down

0 comments on commit 941a98a

Please sign in to comment.