diff --git a/.gitignore b/.gitignore index 29f4159..04ddfec 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ *.spec __pycache__/ *.pyc -.DS_Store \ No newline at end of file +.DS_Store +venv \ No newline at end of file diff --git a/scratchpad.py b/scratchpad.py index 1f6cab7..44928fe 100644 --- a/scratchpad.py +++ b/scratchpad.py @@ -9,8 +9,9 @@ QFileDialog, QMessageBox, QStatusBar, QDialog, QInputDialog, QVBoxLayout, QLabel, QLineEdit, QPushButton, QHBoxLayout) from PyQt5.QtCore import QThread, pyqtSignal, Qt, QSettings, QSignalBlocker -from PyQt5.QtGui import QIcon, QFont, QFontDatabase, QTextDocument +from PyQt5.QtGui import QIcon, QFont, QFontDatabase, QTextDocument, QColor from PyQt5.Qsci import QsciScintilla, QsciScintillaBase +import re @@ -373,6 +374,36 @@ def __init__(self, parent=None): self._zoom = 0 self.setUtf8(True) if hasattr(self, 'setUtf8') else None + css_file_path = os.path.join(os.path.dirname(__file__), 'style.css') + + if os.path.exists(css_file_path): + css_file = open('style.css') + + class_name = 'Editor' + regex_pattern = rf"\b{class_name}\b\s*\{{([^}}]*)\}}" + + match = re.search(regex_pattern, css_file.read(), re.IGNORECASE) + + if match: + internals = match.group(1).strip() + + bg_match = re.search(r"background-color\s*:\s*([^;]+)", internals) + text_match = re.search(r"(?