Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
*.spec
__pycache__/
*.pyc
.DS_Store
.DS_Store
venv
33 changes: 32 additions & 1 deletion scratchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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"(?<!-)color\s*:\s*([^;]+)", internals)

if bg_match:
bg_color = bg_match.group(1).strip()
self.setPaper(QColor(bg_color))

if text_match:
text_color = text_match.group(1).strip()
self.setColor(QColor(text_color))
self.setCaretForegroundColor(QColor(text_color))

css_file.close()
else:
print("Default CSS file not found: {css_file_path}")


def append_text(self, text: str):
try:
data = text.encode('utf-8', errors='replace')
Expand Down
49 changes: 45 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@
Scratchpad Professional
*/

Editor {
background-color: #ffffff;
color: #000000;
}

/* Text area */
QTextEdit, QDialog QTextEdit, QsciScintilla, QDialog QsciScintilla {
font-family: 'Cascadia Code', 'Courier New', Courier, monospace;
font-weight: 400;
font-size: 14px;
background-color: #f5f5f5;
color: #000000;
border: none;
border: 1px solid #cccccc;
padding: 2px;
}

/* Label */
QLabel {
color:#000000;
}

/* Main window */
QMainWindow, QDialog {
background-color: #ffffff;
Expand Down Expand Up @@ -67,15 +78,45 @@ QLineEdit:focus, QDialog QLineEdit:focus {
}

/* Scrollbar */
QScrollBar:horizontal, QDialog QScrollBar:horizontal {
QScrollBar:vertical {
width: 10px;
margin: 0px;
background: transparent;
}

QScrollBar:horizontal {
height: 10px;
margin: 0px;
background: transparent;
}

QScrollBar:vertical, QDialog QScrollBar:vertical {
width: 10px;
/* Groove (track) */
QScrollBar::groove:vertical,
QScrollBar::groove:horizontal {
background: transparent;
border: none;
}

QScrollBar::handle:horizontal, QScrollBar::handle:vertical, QDialog QScrollBar::handle:horizontal, QDialog QScrollBar::handle:vertical {
/* Handle */
QScrollBar::handle:vertical,
QScrollBar::handle:horizontal {
background: #cccccc;
border-radius: 5px;
min-height: 20px;
min-width: 20px;
}

/* Remove arrows completely */
QScrollBar::add-line,
QScrollBar::sub-line {
height: 0px;
width: 0px;
border: none;
background: none;
}

/* Remove page areas */
QScrollBar::add-page,
QScrollBar::sub-page {
background: transparent;
}
92 changes: 92 additions & 0 deletions themes/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
Scratchpad Professional
*/

Editor {
background-color: #ffffff;
color: #000000;
}

/* Text area */
QTextEdit, QDialog QTextEdit, QsciScintilla, QDialog QsciScintilla {
font-family: 'Cascadia Code', 'Courier New', Courier, monospace;
font-weight: 400;
font-size: 14px;
background-color: #f5f5f5;
color: #000000;
border: none;
border: 1px solid #cccccc;
padding: 2px;
}

/* Label */
QLabel {
color:#000000;
}

/* Main window */
QMainWindow, QDialog {
background-color: #ffffff;
}

/* Bottom status bar */
QStatusBar {
background-color: #f1f1f1;
color: #202020;
}

/* Top menu bar */
QMenuBar {
background-color: #0c0c0c;
color: #ffffff;
}

/* Menu bar options */
QMenuBar::item {
background: transparent;
padding: 5px 10px;
}

/* Menu bar options when selected */
QMenuBar::item:selected {
background: #000000;
}

/* Buttons */
QPushButton, QDialog QPushButton {
background: transparent;
border: 1px solid #cccccc;
color: #000000;
padding: 5px 10px;
}

/* Button on hover */
QPushButton:hover, QDialog QPushButton:hover {
background-color: #f5f5f5;
}

/* Line Edit */
QLineEdit, QDialog QLineEdit {
border: 1px solid #cccccc;
padding: 3px;
background-color: #ffffff;
}

/* Focused line edit */
QLineEdit:focus, QDialog QLineEdit:focus {
border-color: #66aaff;
}

/* Scrollbar */
QScrollBar:horizontal, QDialog QScrollBar:horizontal {
height: 10px;
}

QScrollBar:vertical, QDialog QScrollBar:vertical {
width: 10px;
}

QScrollBar::handle:horizontal, QScrollBar::handle:vertical, QDialog QScrollBar::handle:horizontal, QDialog QScrollBar::handle:vertical {
background: #cccccc;
border-radius: 5px;
}
136 changes: 136 additions & 0 deletions themes/really-dark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
Scratchpad Professional - Really Dark Edition
*/

Editor {
background-color: #000000;
color: #ffffff;
}

/* Text Area */
QTextEdit, QDialog QTextEdit, QsciScintilla, QDialog QsciScintilla {
font-family: 'Cascadia Code', 'Courier New', monospace;
font-weight: 400;
font-size: 14px;

background-color: #000000;
color: #ffffff;

border: 1px solid #1a1a1a;
padding: 6px;
}

/* Label */
QLabel {
background-color: #000000;
color: #ffffff;
}

/* Main Window */
QMainWindow, QDialog {
background-color: #000000;
}

/* Bottom status Bar */
QStatusBar {
background-color: #0a0a0a;
color: #dddddd;
border-top: 1px solid #1a1a1a;
}

/* Top menu Bar */
QMenuBar {
background-color: #0d0d0d;
color: #ffffff;
border-bottom: 1px solid #1a1a1a;
}

/* Menu bar options */
QMenuBar::item {
background: transparent;
padding: 6px 12px;
}

/* Menu bar options when selected */
QMenuBar::item:selected {
background: #1a1a1a;
}

/* Dropdown Menus */
QMenu {
background-color: #111111;
color: #ffffff;
border: 1px solid #1f1f1f;
}

QMenu::item {
padding: 6px 20px;
}

QMenu::item:selected {
background-color: #222222;
}

/* Buttons (Dark Gray) */
QPushButton, QDialog QPushButton {
background-color: #1e1e1e;
border: 1px solid #2a2a2a;
color: #ffffff;

padding: 6px 14px;
border-radius: 4px;
}

QPushButton:hover, QDialog QPushButton:hover {
background-color: #2a2a2a;
border: 1px solid #3a3a3a;
}

QPushButton:pressed, QDialog QPushButton:pressed {
background-color: #161616;
}

/* Line Edit */
QLineEdit, QDialog QLineEdit {
background-color: #111111;
color: #ffffff;

border: 1px solid #2a2a2a;
padding: 4px;
border-radius: 3px;
}

QLineEdit:focus, QDialog QLineEdit:focus {
border: 1px solid #444444;
}

/* Scrollbar */
QScrollBar:vertical {
background: #0d0d0d;
width: 12px;
margin: 0px;
}

QScrollBar:horizontal {
background: #0d0d0d;
height: 12px;
margin: 0px;
}

QScrollBar::handle:vertical,
QScrollBar::handle:horizontal {
background: #2a2a2a;
border-radius: 5px;
min-height: 20px;
min-width: 20px;
}

QScrollBar::handle:hover {
background: #3a3a3a;
}

QScrollBar::add-line,
QScrollBar::sub-line {
background: none;
border: none;
}