QSS Themes
QSS (Qt Style Sheet) themes use raw CSS-like syntax for full control over every widget's appearance. You can use gradients, custom borders, pseudo-states, and more.
Quick Start
- Copy
custom_theme.qss.demofrom the themes folder to a new file (e.g.,ocean.qss,midnight.qss) - Edit the file with your colors, borders, and styles using the syntax below
- Save in the themes folder. The theme appears in View → Theme
- Use View → Reload themes to pick up new or edited QSS files
Theme Folder Location
Theme files are stored in the themes folder:
- Exe installation:
%LOCALAPPDATA%\LYTE\themes\ - Portable installation:
themes\(relative to application directory)
Note: %LOCALAPPDATA% typically expands to C:\Users\<YourUsername>\AppData\Local\ on Windows.
File Naming
- Theme files must end with
.qss(e.g.,my_theme.qss) - The filename (without
.qss) becomes the theme identifier and display name - Example:
ocean.qssappears as "Ocean",aurora_theme.qssas "Aurora Theme" - Template:
custom_theme.qss.demo(copy and rename to.qssto use) - Showcase:
aurora_theme.qssdemonstrates gradients, rounded corners, and a purple/cyan palette—select "Aurora Theme" from View → Theme
Basic Structure & Syntax
QSS is similar to CSS. Use widget class names as selectors and pseudo-states for hover, pressed, disabled:
QPushButton {
background-color: #3c463c;
color: #dcdcdc;
border: 1px solid #465a46;
border-radius: 8px;
padding: 8px 16px;
}
QPushButton:hover {
background-color: #507850;
}
QPushButton:pressed {
background-color: #649664;
}
QPushButton:disabled {
background-color: #232323;
color: gray;
}Qt supports qlineargradient and rgba() for gradients and transparency:
QPushButton {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #2d1b4e, stop:1 #1a1225);
border: 2px solid #00d4aa;
}
QMenuBar::item:selected {
background-color: rgba(0, 212, 170, 0.25);
color: #00ffcc;
}Widget Selectors
Use these Qt widget class names and sub-controls to target specific UI elements:
| Selector | Description |
|---|---|
QWidget, QMainWindow, QDialog | Base backgrounds for windows and dialogs |
QPushButton | All buttons |
QPushButton:hover | Button when mouse hovers |
QPushButton:pressed | Button when clicked |
QPushButton:disabled | Disabled button |
QLineEdit, QPlainTextEdit, QTextEdit | Text input fields |
QSpinBox, QComboBox | Number spinners, dropdowns |
QLineEdit:focus, QPlainTextEdit:focus | Input when focused |
QSlider::groove:horizontal | Slider track (volume, progress) |
QSlider::handle:horizontal | Slider thumb/handle |
QSlider::handle:horizontal:hover | Slider handle on hover |
QSlider::sub-page:horizontal | Filled portion of slider (Qt) |
QMenuBar, QMenuBar::item | Menu bar and items |
QMenuBar::item:selected | Selected menu bar item |
QMenu, QMenu::item | Dropdown menus and items |
QMenu::item:selected | Selected menu item |
QListWidget | List containers (banned users, queue, etc.) |
QListWidget::item, ::item:selected, ::item:hover | List items and states |
QCheckBox | Checkbox label |
QCheckBox::indicator | Checkbox box |
QCheckBox::indicator:checked | Checkbox when checked |
QScrollBar:vertical | Vertical scrollbar track |
QScrollBar::handle:vertical | Scrollbar handle |
QScrollBar::handle:vertical:hover | Scrollbar handle on hover |
QComboBox::drop-down | Dropdown arrow button |
QComboBox QAbstractItemView | Dropdown list popup |
QGroupBox, QGroupBox::title | Grouped sections and titles |
QToolTip | Tooltip popups |
QLabel | Text labels |
Common QSS Properties
These CSS-like properties work in QSS. See Qt documentation for the full list.
| Property | Description |
|---|---|
background-color | Solid background color (e.g., #3c463c) |
background | Background including gradients (qlineargradient) |
color | Text color |
border | Border (1px solid #465a46) |
border-radius | Rounded corners (pixels) |
padding | Internal spacing (8px 16px or 6px) |
margin | External spacing |
min-width, min-height | Minimum dimensions |
width, height | Explicit dimensions (e.g., scrollbar width) |
font-family | Font stack |
font-weight | Bold (500, 600) or normal |
selection-background-color | Selected text highlight (inputs) |
subcontrol-origin, subcontrol-position | Qt sub-control positioning (e.g., QGroupBox::title) |
Tips
- Use
custom_theme.qss.demoas a starting point—it styles all LYTE widgets - Test
:hover,:pressed, and:disabledfor interactive feedback qlineargradientcreates smooth gradients—usestop:0andstop:1for top-to-bottomrgba(r, g, b, 0.5)for semi-transparent overlays- Keep contrast high for accessibility
- Use View → Reload themes after editing
Example QSS (Template)
The custom_theme.qss.demo template provides a complete base. Key sections:
QWidget {
background-color: #191919;
color: #dcdcdc;
}
QMainWindow, QDialog {
background-color: #191919;
}
QMenuBar {
background-color: #1e1e1e;
color: #dcdcdc;
}
QMenuBar::item:selected {
background-color: #507850;
}
QPushButton {
background-color: #3c463c;
color: #dcdcdc;
border: 1px solid #465a46;
border-radius: 8px;
padding: 8px 16px;
}
QPushButton:hover {
background-color: #507850;
}
QPushButton:pressed {
background-color: #649664;
}
QLineEdit, QPlainTextEdit, QTextEdit, QSpinBox, QComboBox {
background-color: #232323;
color: #dcdcdc;
border: 1px solid #465a46;
border-radius: 8px;
padding: 6px;
}
QSlider::groove:horizontal {
background: #232323;
height: 8px;
border-radius: 4px;
}
QSlider::handle:horizontal {
background: #649664;
width: 16px;
margin: -4px 0;
border-radius: 8px;
}
QScrollBar:vertical {
background: #232323;
width: 12px;
border-radius: 6px;
}
QScrollBar::handle:vertical {
background: #3c463c;
border-radius: 6px;
min-height: 30px;
}
QListWidget::item:selected {
background-color: #507850;
}
QCheckBox::indicator:checked {
background-color: #649664;
}
QGroupBox {
border: 1px solid #465a46;
border-radius: 8px;
}
QToolTip {
background-color: #232323;
color: #dcdcdc;
border: 1px solid #465a46;
border-radius: 8px;
}For a more dramatic example with gradients and cyan accents, see aurora_theme.qss.