Replaces all dark-Mocha colours (#1e1e2e base, #313244 surface0, etc.) with the noticeably brighter Frappé variants (#303446 base, #414559 surface0, etc.) across the QSS and every hardcoded colour in Python source files (syntax highlighter, completer popup, log viewer, explain view, table viewer, schema browser, icons, etc.). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
86 lines
2.5 KiB
Python
86 lines
2.5 KiB
Python
"""
|
||
Emoji/Unicode icon helpers — no external icon pack dependency.
|
||
All icons are rendered from Unicode characters by Qt.
|
||
"""
|
||
from PyQt6.QtGui import QIcon, QPixmap, QPainter, QFont, QColor
|
||
from PyQt6.QtCore import Qt, QSize
|
||
|
||
|
||
# ── Unicode glyph map ─────────────────────────────────────────────────────────
|
||
ICONS = {
|
||
# Connections
|
||
"connection": "🔌",
|
||
"connected": "🟢",
|
||
"disconnected": "🔴",
|
||
|
||
# Schema tree
|
||
"database": "🗄️",
|
||
"table": "📋",
|
||
"view": "👁️",
|
||
"column": "📊",
|
||
"index": "🔍",
|
||
"primary_key": "🔑",
|
||
"foreign_key": "🔗",
|
||
"function": "⚡",
|
||
"procedure": "📦",
|
||
"trigger": "⚙️",
|
||
"folder": "📁",
|
||
"folder_open": "📂",
|
||
|
||
# Actions
|
||
"run": "▶️",
|
||
"stop": "⏹️",
|
||
"explain": "🔎",
|
||
"new_tab": "➕",
|
||
"save": "💾",
|
||
"open": "📂",
|
||
"export": "📤",
|
||
"import": "📥",
|
||
"refresh": "🔄",
|
||
"delete": "🗑️",
|
||
"edit": "✏️",
|
||
"add": "➕",
|
||
"commit": "✅",
|
||
"rollback": "↩️",
|
||
"history": "📜",
|
||
"filter": "🔍",
|
||
"copy": "📋",
|
||
"clear": "🧹",
|
||
"settings": "⚙️",
|
||
"help": "❓",
|
||
"info": "ℹ️",
|
||
"warning": "⚠️",
|
||
"error": "❌",
|
||
"success": "✅",
|
||
"kill": "🛑",
|
||
"disconnect": "🔌",
|
||
|
||
# DB Types
|
||
"mysql": "🐬",
|
||
"postgresql": "🐘",
|
||
"sqlite": "📁",
|
||
"mssql": "🪟",
|
||
}
|
||
|
||
|
||
def make_icon(glyph: str, size: int = 20,
|
||
fg: str = "#c6d0f5", bg: str = "transparent") -> QIcon:
|
||
"""Create a QIcon from a Unicode glyph."""
|
||
px = QPixmap(QSize(size, size))
|
||
px.fill(Qt.GlobalColor.transparent)
|
||
painter = QPainter(px)
|
||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||
font = QFont()
|
||
font.setPointSize(int(size * 0.55))
|
||
painter.setFont(font)
|
||
painter.setPen(QColor(fg))
|
||
painter.drawText(px.rect(), Qt.AlignmentFlag.AlignCenter, glyph)
|
||
painter.end()
|
||
return QIcon(px)
|
||
|
||
|
||
def get_icon(name: str, size: int = 20) -> QIcon:
|
||
"""Get a named icon. Falls back to a question mark if unknown."""
|
||
glyph = ICONS.get(name, "❓")
|
||
return make_icon(glyph, size)
|