Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
57b407db
P
PyQt Fluent Widgets
项目概览
k54kdk
/
PyQt Fluent Widgets
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PyQt Fluent Widgets
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
57b407db
编写于
3月 23, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加修改主题色的功能, #34
上级
1734a8ae
变更
30
展开全部
隐藏空白更改
内联
并排
Showing
30 changed file
with
42269 addition
and
42175 deletion
+42269
-42175
examples/combo_box/demo.py
examples/combo_box/demo.py
+3
-2
examples/navigation/demo.py
examples/navigation/demo.py
+4
-1
examples/settings/setting_interface.py
examples/settings/setting_interface.py
+1
-1
examples/switch_button/demo.py
examples/switch_button/demo.py
+1
-1
qfluentwidgets/_rc/qss/dark/button.qss
qfluentwidgets/_rc/qss/dark/button.qss
+68
-0
qfluentwidgets/_rc/qss/dark/color_dialog.qss
qfluentwidgets/_rc/qss/dark/color_dialog.qss
+0
-37
qfluentwidgets/_rc/qss/dark/dialog.qss
qfluentwidgets/_rc/qss/dark/dialog.qss
+0
-38
qfluentwidgets/_rc/qss/dark/expand_setting_card.qss
qfluentwidgets/_rc/qss/dark/expand_setting_card.qss
+6
-6
qfluentwidgets/_rc/qss/dark/setting_card.qss
qfluentwidgets/_rc/qss/dark/setting_card.qss
+15
-93
qfluentwidgets/_rc/qss/dark/state_tool_tip.qss
qfluentwidgets/_rc/qss/dark/state_tool_tip.qss
+1
-1
qfluentwidgets/_rc/qss/dark/switch_button.qss
qfluentwidgets/_rc/qss/dark/switch_button.qss
+18
-17
qfluentwidgets/_rc/qss/light/button.qss
qfluentwidgets/_rc/qss/light/button.qss
+68
-0
qfluentwidgets/_rc/qss/light/color_dialog.qss
qfluentwidgets/_rc/qss/light/color_dialog.qss
+0
-37
qfluentwidgets/_rc/qss/light/dialog.qss
qfluentwidgets/_rc/qss/light/dialog.qss
+0
-38
qfluentwidgets/_rc/qss/light/expand_setting_card.qss
qfluentwidgets/_rc/qss/light/expand_setting_card.qss
+6
-6
qfluentwidgets/_rc/qss/light/setting_card.qss
qfluentwidgets/_rc/qss/light/setting_card.qss
+15
-92
qfluentwidgets/_rc/qss/light/state_tool_tip.qss
qfluentwidgets/_rc/qss/light/state_tool_tip.qss
+1
-1
qfluentwidgets/_rc/qss/light/switch_button.qss
qfluentwidgets/_rc/qss/light/switch_button.qss
+15
-14
qfluentwidgets/_rc/resource.py
qfluentwidgets/_rc/resource.py
+41879
-41753
qfluentwidgets/_rc/resource.qrc
qfluentwidgets/_rc/resource.qrc
+2
-0
qfluentwidgets/common/__init__.py
qfluentwidgets/common/__init__.py
+1
-1
qfluentwidgets/common/config.py
qfluentwidgets/common/config.py
+23
-2
qfluentwidgets/common/style_sheet.py
qfluentwidgets/common/style_sheet.py
+93
-3
qfluentwidgets/components/dialog_box/color_dialog.py
qfluentwidgets/components/dialog_box/color_dialog.py
+7
-7
qfluentwidgets/components/dialog_box/dialog.py
qfluentwidgets/components/dialog_box/dialog.py
+4
-4
qfluentwidgets/components/navigation/navigation_widget.py
qfluentwidgets/components/navigation/navigation_widget.py
+2
-2
qfluentwidgets/components/settings/setting_card.py
qfluentwidgets/components/settings/setting_card.py
+2
-10
qfluentwidgets/components/widgets/__init__.py
qfluentwidgets/components/widgets/__init__.py
+2
-1
qfluentwidgets/components/widgets/button.py
qfluentwidgets/components/widgets/button.py
+29
-0
qfluentwidgets/components/widgets/combo_box.py
qfluentwidgets/components/widgets/combo_box.py
+3
-7
未找到文件。
examples/combo_box/demo.py
浏览文件 @
57b407db
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
sys
import
sys
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtWidgets
import
QApplication
,
QWidget
,
QHBoxLayout
from
PyQt5.QtWidgets
import
QApplication
,
QWidget
,
QHBoxLayout
from
qfluentwidgets
import
ComboBox
,
setTheme
,
Theme
from
qfluentwidgets
import
ComboBox
,
setTheme
,
Theme
,
setThemeColor
class
Demo
(
QWidget
):
class
Demo
(
QWidget
):
...
@@ -17,8 +17,9 @@ class Demo(QWidget):
...
@@ -17,8 +17,9 @@ class Demo(QWidget):
self
.
resize
(
500
,
500
)
self
.
resize
(
500
,
500
)
self
.
setStyleSheet
(
'Demo{background:white}'
)
self
.
setStyleSheet
(
'Demo{background:white}'
)
# setTheme(Theme.DARK)
# setTheme(Theme.DARK)
# setThemeColor('#0078d4')
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
examples/navigation/demo.py
浏览文件 @
57b407db
...
@@ -5,7 +5,7 @@ from PyQt5.QtGui import QIcon, QPainter, QImage, QBrush, QColor, QFont
...
@@ -5,7 +5,7 @@ from PyQt5.QtGui import QIcon, QPainter, QImage, QBrush, QColor, QFont
from
PyQt5.QtWidgets
import
QApplication
,
QFrame
,
QStackedWidget
,
QHBoxLayout
,
QLabel
from
PyQt5.QtWidgets
import
QApplication
,
QFrame
,
QStackedWidget
,
QHBoxLayout
,
QLabel
from
qfluentwidgets
import
(
NavigationInterface
,
NavigationItemPostion
,
NavigationWidget
,
MessageBox
,
from
qfluentwidgets
import
(
NavigationInterface
,
NavigationItemPostion
,
NavigationWidget
,
MessageBox
,
isDarkTheme
,
setTheme
,
Theme
)
isDarkTheme
,
setTheme
,
Theme
,
setThemeColor
)
from
qfluentwidgets
import
FluentIcon
as
FIF
from
qfluentwidgets
import
FluentIcon
as
FIF
from
qframelesswindow
import
FramelessWindow
,
StandardTitleBar
from
qframelesswindow
import
FramelessWindow
,
StandardTitleBar
...
@@ -68,6 +68,9 @@ class Window(FramelessWindow):
...
@@ -68,6 +68,9 @@ class Window(FramelessWindow):
# use dark theme mode
# use dark theme mode
setTheme
(
Theme
.
DARK
)
setTheme
(
Theme
.
DARK
)
# change the theme color
# setThemeColor('#0078d4')
self
.
hBoxLayout
=
QHBoxLayout
(
self
)
self
.
hBoxLayout
=
QHBoxLayout
(
self
)
self
.
navigationInterface
=
NavigationInterface
(
self
,
showMenuButton
=
True
)
self
.
navigationInterface
=
NavigationInterface
(
self
,
showMenuButton
=
True
)
self
.
stackWidget
=
QStackedWidget
(
self
)
self
.
stackWidget
=
QStackedWidget
(
self
)
...
...
examples/settings/setting_interface.py
浏览文件 @
57b407db
...
@@ -3,7 +3,7 @@ from config import cfg, HELP_URL, FEEDBACK_URL, AUTHOR, VERSION, YEAR
...
@@ -3,7 +3,7 @@ from config import cfg, HELP_URL, FEEDBACK_URL, AUTHOR, VERSION, YEAR
from
qfluentwidgets
import
(
SettingCardGroup
,
SwitchSettingCard
,
FolderListSettingCard
,
from
qfluentwidgets
import
(
SettingCardGroup
,
SwitchSettingCard
,
FolderListSettingCard
,
OptionsSettingCard
,
RangeSettingCard
,
PushSettingCard
,
OptionsSettingCard
,
RangeSettingCard
,
PushSettingCard
,
ColorSettingCard
,
HyperlinkCard
,
PrimaryPushSettingCard
,
ScrollArea
,
ColorSettingCard
,
HyperlinkCard
,
PrimaryPushSettingCard
,
ScrollArea
,
ComboBoxSettingCard
,
ExpandLayout
,
Theme
,
ToastToolTip
,
setTheme
)
ComboBoxSettingCard
,
ExpandLayout
,
Theme
,
ToastToolTip
,
setTheme
,
setThemeColor
)
from
qfluentwidgets
import
FluentIcon
as
FIF
from
qfluentwidgets
import
FluentIcon
as
FIF
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QUrl
,
QStandardPaths
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QUrl
,
QStandardPaths
from
PyQt5.QtGui
import
QDesktopServices
from
PyQt5.QtGui
import
QDesktopServices
...
...
examples/switch_button/demo.py
浏览文件 @
57b407db
...
@@ -26,7 +26,7 @@ if __name__ == '__main__':
...
@@ -26,7 +26,7 @@ if __name__ == '__main__':
Qt
.
HighDpiScaleFactorRoundingPolicy
.
PassThrough
)
Qt
.
HighDpiScaleFactorRoundingPolicy
.
PassThrough
)
QApplication
.
setAttribute
(
Qt
.
AA_EnableHighDpiScaling
)
QApplication
.
setAttribute
(
Qt
.
AA_EnableHighDpiScaling
)
QApplication
.
setAttribute
(
Qt
.
AA_UseHighDpiPixmaps
)
QApplication
.
setAttribute
(
Qt
.
AA_UseHighDpiPixmaps
)
app
=
QApplication
(
sys
.
argv
)
app
=
QApplication
(
sys
.
argv
)
w
=
Window
()
w
=
Window
()
w
.
show
()
w
.
show
()
...
...
qfluentwidgets/_rc/qss/dark/button.qss
0 → 100644
浏览文件 @
57b407db
PushButton {
background: rgb(45, 45, 45);
border: 1px solid rgb(48, 48, 48);
border-top: 1px solid rgb(53, 53, 53);
border-radius: 4px;
color: white;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 0;
}
PushButton:hover {
background: rgb(50, 50, 50);
}
PushButton:pressed {
color: rgba(255, 255, 255, 0.63);
background: rgb(39, 39, 39);
border: 1px solid rgb(48, 48, 48);
}
PushButton:disabled {
color: rgba(255, 255, 255, 0.63);
background: rgb(59, 59, 59);
border: 1px solid rgb(80, 80, 80);
}
PrimaryPushButton {
color: black;
background-color: --ThemeColorPrimary;
border: 1px solid --ThemeColorLight1;
border-bottom: 1px solid --ThemeColorLight2;
}
PrimaryPushButton:hover {
background-color: --ThemeColorDark1;
border: 1px solid --ThemeColorLight1;
border-bottom: 1px solid --ThemeColorLight2;
}
PrimaryPushButton:pressed {
color: rgba(0, 0, 0, 0.63);
background-color: --ThemeColorDark2;
border: 1px solid --ThemeColorDark2;
}
PrimaryPushButton:disabled {
color: rgb(82, 82, 82);
background-color: rgb(52, 52, 52);
border: 1px solid rgb(52, 52, 52);
}
HyperlinkButton {
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 12px 6px 12px;
color: --ThemeColorPrimary;
border: none;
border-radius: 6px;
background-color: transparent;
}
HyperlinkButton:hover {
background-color: rgba(255, 255, 255, 10);
}
HyperlinkButton:pressed {
background-color: rgba(255, 255, 255, 7);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/dark/color_dialog.qss
浏览文件 @
57b407db
...
@@ -46,44 +46,7 @@ QLabel {
...
@@ -46,44 +46,7 @@ QLabel {
font-size: 14px;
font-size: 14px;
}
}
QPushButton {
background: rgb(45, 45, 45);
border: 1px solid rgb(48, 48, 48);
border-top: 1px solid rgb(53, 53, 53);
border-radius: 4px;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 0;
color: white;
}
QPushButton:hover {
background: rgb(50, 50, 50);
}
QPushButton:pressed {
background: rgb(39, 39, 39);
border: 1px solid rgb(48, 48, 48);
}
QPushButton#yesButton {
color: black;
background-color: rgb(41, 247, 255);
border: 1px solid rgb(58, 248, 255);
border-bottom: 1px solid rgb(35, 213, 255);
}
QPushButton#yesButton:hover {
background-color: rgb(39, 225, 232);
border: 1px solid rgb(56, 227, 234);
border-bottom: 1px solid rgb(15, 73, 85);
}
QPushButton#yesButton:pressed {
background-color: rgb(38, 203, 210);
border: 1px solid rgb(38, 203, 210);
}
/* 滑动条 */
QSlider:horizontal {
QSlider:horizontal {
min-width: 332px;
min-width: 332px;
min-height: 24px;
min-height: 24px;
...
...
qfluentwidgets/_rc/qss/dark/dialog.qss
浏览文件 @
57b407db
...
@@ -43,41 +43,3 @@ QLabel#windowTitleLabel {
...
@@ -43,41 +43,3 @@ QLabel#windowTitleLabel {
padding: 6px 6px;
padding: 6px 6px;
background-color: rgb(32, 32, 32);
background-color: rgb(32, 32, 32);
}
}
QPushButton {
background: rgb(45, 45, 45);
border: 1px solid rgb(48, 48, 48);
border-top: 1px solid rgb(53, 53, 53);
border-radius: 4px;
color: white;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding-top: 6px;
padding-bottom: 6px;
}
QPushButton:hover {
background: rgb(50, 50, 50);
}
QPushButton:pressed {
background: rgb(39, 39, 39);
border: 1px solid rgb(48, 48, 48);
}
QPushButton#yesButton {
color: black;
background-color: rgb(41, 247, 255);
border: 1px solid rgb(58, 248, 255);
border-bottom: 1px solid rgb(35, 213, 255);
}
QPushButton#yesButton:hover {
background-color: rgb(39, 225, 232);
border: 1px solid rgb(56, 227, 234);
border-bottom: 1px solid rgb(15, 73, 85);
}
QPushButton#yesButton:pressed {
background-color: rgb(38, 203, 210);
border: 1px solid rgb(38, 203, 210);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/dark/expand_setting_card.qss
浏览文件 @
57b407db
...
@@ -122,24 +122,24 @@ QRadioButton::indicator:checked {
...
@@ -122,24 +122,24 @@ QRadioButton::indicator:checked {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(0, 0, 0),
stop:0 rgb(0, 0, 0),
stop:0.5 rgb(0, 0, 0),
stop:0.5 rgb(0, 0, 0),
stop:0.6
rgb(72, 210, 242)
,
stop:0.6
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton::indicator:checked:hover {
QRadioButton::indicator:checked:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(0, 0, 0),
stop:0 rgb(0, 0, 0),
stop:0.6 rgb(0, 0, 0),
stop:0.6 rgb(0, 0, 0),
stop:0.7
rgb(72, 210, 242)
,
stop:0.7
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton::indicator:checked:pressed {
QRadioButton::indicator:checked:pressed {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(0, 0, 0),
stop:0 rgb(0, 0, 0),
stop:0.5 rgb(0, 0, 0),
stop:0.5 rgb(0, 0, 0),
stop:0.6
rgb(72, 210, 242)
,
stop:0.6
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton:disabled {
QRadioButton:disabled {
...
...
qfluentwidgets/_rc/qss/dark/setting_card.qss
浏览文件 @
57b407db
...
@@ -31,7 +31,7 @@ QSlider::groove:horizontal {
...
@@ -31,7 +31,7 @@ QSlider::groove:horizontal {
}
}
QSlider::sub-page:horizontal {
QSlider::sub-page:horizontal {
background:
rgb(41, 247, 255)
;
background:
--ThemeColorPrimary
;
height: 4px;
height: 4px;
border-radius: 2px;
border-radius: 2px;
}
}
...
@@ -43,24 +43,24 @@ QSlider::handle:horizontal {
...
@@ -43,24 +43,24 @@ QSlider::handle:horizontal {
margin: -9px 0;
margin: -9px 0;
border-radius: 11px;
border-radius: 11px;
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(41, 247, 255)
,
stop:0
--ThemeColorPrimary
,
stop:0.5
rgb(41, 247, 255)
,
stop:0.5
--ThemeColorPrimary
,
stop:0.6 rgb(69, 69, 69),
stop:0.6 rgb(69, 69, 69),
stop:1 rgb(69, 69, 69));
stop:1 rgb(69, 69, 69));
}
}
QSlider::handle:horizontal:hover {
QSlider::handle:horizontal:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(41, 247, 255)
,
stop:0
--ThemeColorPrimary
,
stop:0.6
rgb(41, 247, 255)
,
stop:0.6
--ThemeColorPrimary
,
stop:0.7 rgb(69, 69, 69),
stop:0.7 rgb(69, 69, 69),
stop:1 rgb(69, 69, 69));
stop:1 rgb(69, 69, 69));
}
}
QSlider::handle:horizontal:pressed {
QSlider::handle:horizontal:pressed {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(41, 247, 255)
,
stop:0
--ThemeColorPrimary
,
stop:0.4
rgb(41, 247, 255)
,
stop:0.4
--ThemeColorPrimary
,
stop:0.5 rgb(69, 69, 69),
stop:0.5 rgb(69, 69, 69),
stop:1 rgb(69, 69, 69));
stop:1 rgb(69, 69, 69));
}
}
...
@@ -70,67 +70,6 @@ RangeSettingCard > QLabel#valueLabel{
...
@@ -70,67 +70,6 @@ RangeSettingCard > QLabel#valueLabel{
}
}
/* 切换开关 */
SwitchButton {
qproperty-spacing: 12;
}
SwitchButton>QLabel {
color: white;
font: 14px 'Segoe UI', 'Microsoft YaHei';
background-color: transparent;
border: none;
}
Indicator {
height: 16px;
width: 37px;
qproperty-sliderOnColor: black;
qproperty-sliderOffColor: rgb(210, 211, 210);
qproperty-sliderDisabledColor: rgb(155, 154, 153);
border-radius: 10px;
}
Indicator:!checked {
background-color: rgb(58, 60, 59);
border: 1px solid rgb(162, 163, 162);
}
Indicator:!checked:hover {
background-color: rgb(58, 60, 59);
border: 1px solid rgb(160, 161, 161);
qproperty-sliderOffColor: rgb(91, 91, 91);
}
Indicator:!checked:pressed {
background-color: rgb(162, 163, 163);
border: 1px solid rgb(133, 133, 133);
qproperty-sliderOffColor: rgb(87, 87, 87);
}
Indicator:checked {
border: 1px solid rgb(41, 247, 255);
background-color: rgb(41, 247, 255);
}
Indicator:checked:hover {
border: 1px solid rgb(41, 227, 234);
background-color: rgb(41, 227, 234);
}
Indicator:checked:pressed {
border: 1px solid rgb(45, 210, 217);
background-color: rgb(45, 210, 217);
}
Indicator:disabled {
border: 1px solid #646464;
background-color: transparent;
}
/* QPushButton */
QPushButton {
QPushButton {
border: 1px solid rgba(255, 255, 255, 24);
border: 1px solid rgba(255, 255, 255, 24);
border-radius: 5px;
border-radius: 5px;
...
@@ -151,41 +90,24 @@ QPushButton:pressed {
...
@@ -151,41 +90,24 @@ QPushButton:pressed {
color: rgba(255, 255, 255, 0.63);
color: rgba(255, 255, 255, 0.63);
}
}
#hyperlinkButton {
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 12px 6px 12px;
color: rgb(41, 243, 255);
border: none;
border-radius: 6px;
background-color: transparent;
}
#hyperlinkButton:hover {
background-color: rgba(255, 255, 255, 10);
}
#hyperlinkButton:pressed {
background-color: rgba(255, 255, 255, 7);
}
#primaryButton {
#primaryButton {
color: black;
color: black;
background-color:
rgb(41, 243, 255)
;
background-color:
--ThemeColorPrimary
;
border: 1px solid
rgb(58, 248, 255)
;
border: 1px solid
--ThemeColorLight1
;
border-bottom: 1px solid
rgb(35, 213, 220)
;
border-bottom: 1px solid
--ThemeColorLight2
;
padding: 5px 12px 5px 12px;
padding: 5px 12px 5px 12px;
}
}
#primaryButton:hover {
#primaryButton:hover {
background-color:
rgb(41, 227, 234)
;
background-color:
--ThemeColorDark1
;
border: 1px solid
rgb(58, 229, 236)
;
border: 1px solid
--ThemeColorLight1
;
border-bottom: 1px solid
rgb(35, 196, 202)
;
border-bottom: 1px solid
--ThemeColorLight2
;
}
}
#primaryButton:pressed {
#primaryButton:pressed {
background-color: rgb(42, 207, 214);
border: 1px solid rgb(42, 207, 214);
color: rgba(0, 0, 0, 0.63);
color: rgba(0, 0, 0, 0.63);
background-color: --ThemeColorDark2;
border: 1px solid --ThemeColorDark2;
}
}
ColorPickerButton {
ColorPickerButton {
...
...
qfluentwidgets/_rc/qss/dark/state_tool_tip.qss
浏览文件 @
57b407db
StateToolTip,
StateToolTip,
ToastToolTip {
ToastToolTip {
background-color:
rgb(0, 107, 131)
;
background-color:
--ThemeColorDark1
;
border: none;
border: none;
border-radius: 7px;
border-radius: 7px;
}
}
...
...
qfluentwidgets/_rc/qss/dark/switch_button.qss
浏览文件 @
57b407db
...
@@ -18,44 +18,45 @@ SwitchButton>QLabel {
...
@@ -18,44 +18,45 @@ SwitchButton>QLabel {
Indicator {
Indicator {
height: 16px;
height: 16px;
width: 37px;
width: 37px;
qproperty-sliderOnColor:
white
;
qproperty-sliderOnColor:
black
;
qproperty-sliderOffColor:
white
;
qproperty-sliderOffColor:
rgb(210, 211, 210)
;
qproperty-sliderDisabledColor: rgb(155, 154, 153);
qproperty-sliderDisabledColor: rgb(155, 154, 153);
border-radius: 10px;
border-radius: 10px;
}
}
Indicator:!checked {
Indicator:!checked {
background-color:
transparent
;
background-color:
rgb(45, 45, 45)
;
border: 1px solid rgb(1
02, 102, 10
2);
border: 1px solid rgb(1
62, 163, 16
2);
}
}
Indicator:!checked:hover {
Indicator:!checked:hover {
border: 1px solid rgb(204, 204, 204);
background-color: rgb(58, 60, 59);
background-color: transparent;
border: 1px solid rgb(160, 161, 161);
qproperty-sliderOffColor: rgb(91, 91, 91);
}
}
Indicator:!checked:pressed {
Indicator:!checked:pressed {
border: 1px solid rgb(102, 102, 102);
background-color: rgb(64, 65, 64);
background-color: rgb(102, 102, 102);
border: 1px solid rgb(164, 165, 165);
qproperty-sliderOffColor: rgb(87, 87, 87);
}
}
Indicator:checked {
Indicator:checked {
border: 1px solid
rgb(0, 153, 188)
;
border: 1px solid
--ThemeColorPrimary
;
background-color:
rgb(0, 153, 188)
;
background-color:
--ThemeColorPrimary
;
}
}
Indicator:checked:hover {
Indicator:checked:hover {
border: 1px solid
rgb(72, 210, 242)
;
border: 1px solid
--ThemeColorDark1
;
background-color:
rgb(72, 210, 242)
;
background-color:
--ThemeColorDark1
;
}
}
Indicator:checked:pressed {
Indicator:checked:pressed {
border: 1px solid
rgb(0, 107, 131)
;
border: 1px solid
--ThemeColorDark2
;
background-color:
rgb(0, 107, 131)
;
background-color:
--ThemeColorDark2
;
}
}
Indicator:disabled {
Indicator:disabled {
border: 1px solid rgb(1
94, 194, 191
);
border: 1px solid rgb(1
00, 100, 100
);
background-color:
rgb(194, 194, 191)
;
background-color:
transparent
;
}
}
\ No newline at end of file
qfluentwidgets/_rc/qss/light/button.qss
0 → 100644
浏览文件 @
57b407db
PushButton {
color: black;
background: rgb(251, 251, 251);
border: 1px solid rgb(229, 229, 229);
border-bottom: 1px solid rgb(204, 204, 204);
border-radius: 4px;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 0;
}
PushButton:hover {
background: rgb(246, 246, 246);
}
PushButton:pressed {
color: rgba(0, 0, 0, 0.63);
background: rgb(245, 245, 245);
border-bottom: 1px solid rgb(229, 229, 229);
}
PushButton:disabled {
color: rgba(0, 0, 0, 0.63);
background: rgb(252, 252, 252);
border: 1px solid rgb(223, 223, 223);
}
PrimaryPushButton {
color: white;
background-color: --ThemeColorPrimary;
border: 1px solid --ThemeColorLight1;
border-bottom: 1px solid --ThemeColorDark1;
}
PrimaryPushButton:hover {
background-color: --ThemeColorLight1;
border: 1px solid --ThemeColorLight2;
border-bottom: 1px solid --ThemeColorDark1;
}
PrimaryPushButton:pressed {
color: rgba(255, 255, 255, 0.63);
background-color: --ThemeColorLight3;
border: 1px solid --ThemeColorLight3;
}
PrimaryPushButton:disabled {
color: rgba(255, 255, 255, 0.63);
background-color: rgb(199, 199, 199);
border: 1px solid rgb(199, 199, 199);
}
HyperlinkButton {
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 12px 6px 12px;
color: --ThemeColorPrimary;
border: none;
border-radius: 6px;
background-color: transparent;
}
HyperlinkButton:hover {
background-color: rgba(0, 0, 0, 15);
}
HyperlinkButton:pressed {
background-color: rgba(0, 0, 0, 7);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/light/color_dialog.qss
浏览文件 @
57b407db
...
@@ -44,44 +44,7 @@ QLabel {
...
@@ -44,44 +44,7 @@ QLabel {
font-size: 14px;
font-size: 14px;
}
}
QPushButton {
color: black;
background: rgb(251, 251, 251);
border: 1px solid rgb(229, 229, 229);
border-bottom: 1px solid rgb(204, 204, 204);
border-radius: 4px;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 0;
}
QPushButton:hover {
background: rgb(246, 246, 246);
}
QPushButton:pressed {
background: rgb(245, 245, 245);
border-bottom: 1px solid rgb(229, 229, 229);
}
QPushButton#yesButton {
color: white;
background-color: rgb(0, 107, 131);
border: 1px solid rgb(20, 119, 141);
border-bottom: 1px solid rgb(0, 64, 79);
}
QPushButton#yesButton:hover {
background-color: rgb(25, 121, 142);
border: 1px solid rgb(43, 132, 151);
border-bottom: 1px solid rgb(15, 73, 85);
}
QPushButton#yesButton:pressed {
background-color: rgb(49, 134, 153);
border: 1px solid rgb(49, 134, 153);
}
/* 滑动条 */
QSlider:horizontal {
QSlider:horizontal {
min-width: 332px;
min-width: 332px;
min-height: 24px;
min-height: 24px;
...
...
qfluentwidgets/_rc/qss/light/dialog.qss
浏览文件 @
57b407db
...
@@ -43,41 +43,3 @@ QLabel#windowTitleLabel {
...
@@ -43,41 +43,3 @@ QLabel#windowTitleLabel {
padding: 6px 6px;
padding: 6px 6px;
background-color: rgb(243, 243, 243);
background-color: rgb(243, 243, 243);
}
}
QPushButton {
color: black;
background: rgb(251, 251, 251);
border: 1px solid rgb(229, 229, 229);
border-bottom: 1px solid rgb(204, 204, 204);
border-radius: 4px;
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding-top: 6px;
padding-bottom: 6px;
}
QPushButton:hover {
background: rgb(246, 246, 246);
}
QPushButton:pressed {
background: rgb(245, 245, 245);
border-bottom: 1px solid rgb(229, 229, 229);
}
QPushButton#yesButton {
color: white;
background-color: rgb(0, 107, 131);
border: 1px solid rgb(20, 119, 141);
border-bottom: 1px solid rgb(0, 64, 79);
}
QPushButton#yesButton:hover {
background-color: rgb(25, 121, 142);
border: 1px solid rgb(43, 132, 151);
border-bottom: 1px solid rgb(15, 73, 85);
}
QPushButton#yesButton:pressed {
background-color: rgb(49, 134, 153);
border: 1px solid rgb(49, 134, 153);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/light/expand_setting_card.qss
浏览文件 @
57b407db
...
@@ -122,24 +122,24 @@ QRadioButton::indicator:checked {
...
@@ -122,24 +122,24 @@ QRadioButton::indicator:checked {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(255, 255, 255),
stop:0 rgb(255, 255, 255),
stop:0.5 rgb(255, 255, 255),
stop:0.5 rgb(255, 255, 255),
stop:0.6
rgb(72, 210, 242)
,
stop:0.6
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton::indicator:checked:hover {
QRadioButton::indicator:checked:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(255, 255, 255),
stop:0 rgb(255, 255, 255),
stop:0.6 rgb(255, 255, 255),
stop:0.6 rgb(255, 255, 255),
stop:0.7
rgb(72, 210, 242)
,
stop:0.7
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton::indicator:checked:pressed {
QRadioButton::indicator:checked:pressed {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0 rgb(255, 255, 255),
stop:0 rgb(255, 255, 255),
stop:0.5 rgb(255, 255, 255),
stop:0.5 rgb(255, 255, 255),
stop:0.6
rgb(72, 210, 242)
,
stop:0.6
--ThemeColorPrimary
,
stop:1
rgb(72, 210, 242)
);
stop:1
--ThemeColorPrimary
);
}
}
QRadioButton:disabled {
QRadioButton:disabled {
...
...
qfluentwidgets/_rc/qss/light/setting_card.qss
浏览文件 @
57b407db
...
@@ -31,7 +31,7 @@ QSlider::groove:horizontal {
...
@@ -31,7 +31,7 @@ QSlider::groove:horizontal {
}
}
QSlider::sub-page:horizontal {
QSlider::sub-page:horizontal {
background:
rgb(0, 159, 170)
;
background:
--ThemeColorPrimary
;
height: 4px;
height: 4px;
border-radius: 2px;
border-radius: 2px;
}
}
...
@@ -43,24 +43,24 @@ QSlider::handle:horizontal {
...
@@ -43,24 +43,24 @@ QSlider::handle:horizontal {
margin: -9px 0;
margin: -9px 0;
border-radius: 11px;
border-radius: 11px;
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(0, 159, 170)
,
stop:0
--ThemeColorPrimary
,
stop:0.5
rgb(0, 159, 170)
,
stop:0.5
--ThemeColorPrimary
,
stop:0.6 rgb(255, 255, 255),
stop:0.6 rgb(255, 255, 255),
stop:1 rgb(255, 255, 255));
stop:1 rgb(255, 255, 255));
}
}
QSlider::handle:horizontal:hover {
QSlider::handle:horizontal:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(0, 159, 170)
,
stop:0
--ThemeColorPrimary
,
stop:0.6
rgb(0, 159, 170)
,
stop:0.6
--ThemeColorPrimary
,
stop:0.7 rgb(255, 255, 255),
stop:0.7 rgb(255, 255, 255),
stop:1 rgb(255, 255, 255));
stop:1 rgb(255, 255, 255));
}
}
QSlider::handle:horizontal:pressed {
QSlider::handle:horizontal:pressed {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
stop:0
rgb(0, 159, 170)
,
stop:0
--ThemeColorPrimary
,
stop:0.4
rgb(0, 159, 170)
,
stop:0.4
--ThemeColorPrimary
,
stop:0.5 rgb(255, 255, 255),
stop:0.5 rgb(255, 255, 255),
stop:1 rgb(255, 255, 255));
stop:1 rgb(255, 255, 255));
}
}
...
@@ -79,67 +79,6 @@ RangeSettingCard > QLabel#valueLabel{
...
@@ -79,67 +79,6 @@ RangeSettingCard > QLabel#valueLabel{
}
}
/* 切换开关 */
SwitchButton {
qproperty-spacing: 12;
}
SwitchButton>QLabel {
color: black;
font: 14px 'Segoe UI', 'Microsoft YaHei';
background-color: transparent;
border: none;
}
Indicator {
height: 16px;
width: 37px;
qproperty-sliderOnColor: white;
qproperty-sliderOffColor: rgb(96, 96, 96);
qproperty-sliderDisabledColor: rgb(155, 154, 153);
border-radius: 10px;
}
Indicator:!checked {
background-color: rgb(247, 247, 247);
border: 1px solid rgb(139, 139, 139);
}
Indicator:!checked:hover {
border: 1px solid rgb(136, 136, 136);
background-color: rgb(238, 238, 238);
qproperty-sliderOffColor: rgb(91, 91, 91);
}
Indicator:!checked:pressed {
border: 1px solid rgb(133, 133, 133);
background-color: rgb(229, 229, 229);
qproperty-sliderOffColor: rgb(87, 87, 87);
}
Indicator:checked {
border: 1px solid rgb(0, 159, 170);
background-color: rgb(0, 159, 170);
}
Indicator:checked:hover {
border: 1px solid rgb(26, 169, 179);
background-color: rgb(26, 169, 179);
}
Indicator:checked:pressed {
border: 1px solid rgb(46, 173, 182);
background-color: rgb(46, 173, 182);
}
Indicator:disabled {
border: 1px solid rgb(194, 194, 191);
background-color: rgb(194, 194, 191);
}
/* QPushButton */
QPushButton {
QPushButton {
border: 1px solid rgb(238, 239, 238);
border: 1px solid rgb(238, 239, 238);
border-radius: 5px;
border-radius: 5px;
...
@@ -160,41 +99,25 @@ QPushButton:pressed {
...
@@ -160,41 +99,25 @@ QPushButton:pressed {
color: rgba(0, 0, 0, 0.63);
color: rgba(0, 0, 0, 0.63);
}
}
#hyperlinkButton {
font: 14px 'Segoe UI', 'Microsoft YaHei';
padding: 6px 12px 6px 12px;
color: rgb(0, 107, 133);
border: none;
border-radius: 6px;
background-color: transparent;
}
#hyperlinkButton:hover {
background-color: rgba(0, 0, 0, 15);
}
#hyperlinkButton:pressed {
background-color: rgba(0, 0, 0, 7);
}
#primaryButton {
#primaryButton {
color: white;
color: white;
background-color:
rgb(0, 159, 170)
;
background-color:
--ThemeColorPrimary
;
border: 1px solid
rgb(20, 167, 177)
;
border: 1px solid
--ThemeColorLight1
;
border-bottom: 1px solid
rgb(0, 95, 102)
;
border-bottom: 1px solid
--ThemeColorDark1
;
padding: 5px 12px 5px 12px;
padding: 5px 12px 5px 12px;
}
}
#primaryButton:hover {
#primaryButton:hover {
background-color:
rgb(26, 169, 179)
;
background-color:
--ThemeColorLight1
;
border: 1px solid
rgb(44, 176, 185)
;
border: 1px solid
--ThemeColorLight2
;
border-bottom: 1px solid
rgb(16, 101, 107)
;
border-bottom: 1px solid
--ThemeColorDark1
;
}
}
#primaryButton:pressed {
#primaryButton:pressed {
background-color: rgb(51, 178, 187);
border: 1px solid rgb(51, 178, 187);
color: rgba(255, 255, 255, 0.63);
color: rgba(255, 255, 255, 0.63);
background-color: --ThemeColorLight3;
border: 1px solid --ThemeColorLight3;
}
}
ColorPickerButton {
ColorPickerButton {
...
...
qfluentwidgets/_rc/qss/light/state_tool_tip.qss
浏览文件 @
57b407db
StateToolTip,
StateToolTip,
ToastToolTip {
ToastToolTip {
background-color:
rgb(0, 107, 131)
;
background-color:
--ThemeColorDark1
;
border: none;
border: none;
border-radius: 7px;
border-radius: 7px;
}
}
...
...
qfluentwidgets/_rc/qss/light/switch_button.qss
浏览文件 @
57b407db
...
@@ -19,40 +19,41 @@ Indicator {
...
@@ -19,40 +19,41 @@ Indicator {
height: 16px;
height: 16px;
width: 37px;
width: 37px;
qproperty-sliderOnColor: white;
qproperty-sliderOnColor: white;
qproperty-sliderOffColor:
black
;
qproperty-sliderOffColor:
rgb(96, 96, 96)
;
qproperty-sliderDisabledColor: rgb(155, 154, 153);
qproperty-sliderDisabledColor: rgb(155, 154, 153);
border-radius: 10px;
border-radius: 10px;
}
}
Indicator:!checked {
Indicator:!checked {
background-color:
transparent
;
background-color:
rgb(247, 247, 247)
;
border: 1px solid rgb(1
02, 102, 102
);
border: 1px solid rgb(1
39, 139, 139
);
}
}
Indicator:!checked:hover {
Indicator:!checked:hover {
border: 1px solid rgb(51, 51, 51);
border: 1px solid rgb(136, 136, 136);
background-color: transparent;
background-color: rgb(238, 238, 238);
qproperty-sliderOffColor: rgb(91, 91, 91);
}
}
Indicator:!checked:pressed {
Indicator:!checked:pressed {
border: 1px solid rgb(0, 0, 0);
border: 1px solid rgb(133, 133, 133);
background-color: rgb(153, 153, 153);
background-color: rgb(229, 229, 229);
qproperty-sliderOffColor: rgb(87, 87, 87);
}
}
Indicator:checked {
Indicator:checked {
border: 1px solid
rgb(0, 153, 188)
;
border: 1px solid
--ThemeColorPrimary
;
background-color:
rgb(0, 153, 188)
;
background-color:
--ThemeColorPrimary
;
}
}
Indicator:checked:hover {
Indicator:checked:hover {
border: 1px solid
rgb(72, 210, 242)
;
border: 1px solid
--ThemeColorLight1
;
background-color:
rgb(72, 210, 242)
;
background-color:
--ThemeColorLight1
;
}
}
Indicator:checked:pressed {
Indicator:checked:pressed {
border: 1px solid
rgb(0, 107, 131)
;
border: 1px solid
--ThemeColorLight2
;
background-color:
rgb(0, 107, 131)
;
background-color:
--ThemeColorLight2
;
}
}
Indicator:disabled {
Indicator:disabled {
...
...
qfluentwidgets/_rc/resource.py
浏览文件 @
57b407db
此差异已折叠。
点击以展开。
qfluentwidgets/_rc/resource.qrc
浏览文件 @
57b407db
...
@@ -104,6 +104,7 @@
...
@@ -104,6 +104,7 @@
<file>qss/dark/folder_list_dialog.qss</file>
<file>qss/dark/folder_list_dialog.qss</file>
<file>qss/dark/combo_box.qss</file>
<file>qss/dark/combo_box.qss</file>
<file>qss/dark/navigation_interface.qss</file>
<file>qss/dark/navigation_interface.qss</file>
<file>qss/dark/button.qss</file>
<file>qss/light/color_dialog.qss</file>
<file>qss/light/color_dialog.qss</file>
<file>qss/light/dialog.qss</file>
<file>qss/light/dialog.qss</file>
...
@@ -118,5 +119,6 @@
...
@@ -118,5 +119,6 @@
<file>qss/light/folder_list_dialog.qss</file>
<file>qss/light/folder_list_dialog.qss</file>
<file>qss/light/combo_box.qss</file>
<file>qss/light/combo_box.qss</file>
<file>qss/light/navigation_interface.qss</file>
<file>qss/light/navigation_interface.qss</file>
<file>qss/light/button.qss</file>
</qresource>
</qresource>
</RCC>
</RCC>
\ No newline at end of file
qfluentwidgets/common/__init__.py
浏览文件 @
57b407db
from
.config
import
*
from
.config
import
*
from
.auto_wrap
import
TextWrap
from
.auto_wrap
import
TextWrap
from
.icon
import
Icon
,
getIconColor
,
drawSvgIcon
,
FluentIcon
,
drawIcon
,
FluentIconBase
from
.icon
import
Icon
,
getIconColor
,
drawSvgIcon
,
FluentIcon
,
drawIcon
,
FluentIconBase
from
.style_sheet
import
setStyleSheet
,
getStyleSheet
,
setTheme
from
.style_sheet
import
setStyleSheet
,
getStyleSheet
,
setTheme
,
ThemeColor
,
themeColor
,
setThemeColor
from
.smooth_scroll
import
SmoothScroll
,
SmoothMode
from
.smooth_scroll
import
SmoothScroll
,
SmoothMode
\ No newline at end of file
qfluentwidgets/common/config.py
浏览文件 @
57b407db
...
@@ -251,9 +251,11 @@ class QConfig(QObject):
...
@@ -251,9 +251,11 @@ class QConfig(QObject):
appRestartSig
=
pyqtSignal
()
appRestartSig
=
pyqtSignal
()
themeChanged
=
pyqtSignal
(
Theme
)
themeChanged
=
pyqtSignal
(
Theme
)
themeColorChanged
=
pyqtSignal
(
QColor
)
themeMode
=
OptionsConfigItem
(
themeMode
=
OptionsConfigItem
(
"QFluentWidgets"
,
"ThemeMode"
,
Theme
.
AUTO
,
OptionsValidator
(
Theme
),
EnumSerializer
(
Theme
))
"QFluentWidgets"
,
"ThemeMode"
,
Theme
.
AUTO
,
OptionsValidator
(
Theme
),
EnumSerializer
(
Theme
))
themeColor
=
ColorConfigItem
(
"QFluentWidgets"
,
"ThemeColor"
,
'#009faa'
)
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
...
@@ -266,7 +268,19 @@ class QConfig(QObject):
...
@@ -266,7 +268,19 @@ class QConfig(QObject):
return
item
.
value
return
item
.
value
def
set
(
self
,
item
,
value
,
save
=
True
):
def
set
(
self
,
item
,
value
,
save
=
True
):
""" set the value of config item """
""" set the value of config item
Parameters
----------
item: ConfigItem
config item
value:
the new value of config item
save: bool
whether to save the change to config file
"""
if
item
.
value
==
value
:
if
item
.
value
==
value
:
return
return
...
@@ -282,6 +296,9 @@ class QConfig(QObject):
...
@@ -282,6 +296,9 @@ class QConfig(QObject):
self
.
theme
=
value
self
.
theme
=
value
self
.
_cfg
.
themeChanged
.
emit
(
value
)
self
.
_cfg
.
themeChanged
.
emit
(
value
)
if
item
is
self
.
_cfg
.
themeColor
:
self
.
_cfg
.
themeColorChanged
.
emit
(
value
)
def
toDict
(
self
,
serialize
=
True
):
def
toDict
(
self
,
serialize
=
True
):
""" convert config items to `dict` """
""" convert config items to `dict` """
items
=
{}
items
=
{}
...
@@ -371,4 +388,8 @@ qconfig = QConfig()
...
@@ -371,4 +388,8 @@ qconfig = QConfig()
def
isDarkTheme
():
def
isDarkTheme
():
""" whether the theme is dark mode """
""" whether the theme is dark mode """
return
qconfig
.
theme
==
Theme
.
DARK
return
qconfig
.
theme
==
Theme
.
DARK
\ No newline at end of file
def
theme
():
""" get theme mode """
return
qconfig
.
theme
\ No newline at end of file
qfluentwidgets/common/style_sheet.py
浏览文件 @
57b407db
# coding:utf-8
# coding:utf-8
from
enum
import
Enum
from
string
import
Template
import
weakref
import
weakref
import
darkdetect
import
darkdetect
from
PyQt5.QtCore
import
QFile
,
QObject
from
PyQt5.QtCore
import
QFile
,
QObject
from
PyQt5.QtGui
import
QColor
from
PyQt5.QtWidgets
import
QWidget
from
PyQt5.QtWidgets
import
QWidget
from
.config
import
qconfig
,
Theme
from
.config
import
qconfig
,
Theme
,
isDarkTheme
class
StyleSheetManager
(
QObject
):
class
StyleSheetManager
(
QObject
):
...
@@ -44,6 +47,12 @@ class StyleSheetManager(QObject):
...
@@ -44,6 +47,12 @@ class StyleSheetManager(QObject):
styleSheetManager
=
StyleSheetManager
()
styleSheetManager
=
StyleSheetManager
()
class
QssTemplate
(
Template
):
""" style sheet template """
delimiter
=
'--'
def
getStyleSheet
(
file
,
theme
=
Theme
.
AUTO
):
def
getStyleSheet
(
file
,
theme
=
Theme
.
AUTO
):
""" get style sheet from `qfluentwidgets` embedded qss file
""" get style sheet from `qfluentwidgets` embedded qss file
...
@@ -58,9 +67,11 @@ def getStyleSheet(file, theme=Theme.AUTO):
...
@@ -58,9 +67,11 @@ def getStyleSheet(file, theme=Theme.AUTO):
theme
=
qconfig
.
theme
if
theme
==
Theme
.
AUTO
else
theme
theme
=
qconfig
.
theme
if
theme
==
Theme
.
AUTO
else
theme
f
=
QFile
(
f
":/qfluentwidgets/qss/
{
theme
.
value
.
lower
()
}
/
{
file
}
.qss"
)
f
=
QFile
(
f
":/qfluentwidgets/qss/
{
theme
.
value
.
lower
()
}
/
{
file
}
.qss"
)
f
.
open
(
QFile
.
ReadOnly
)
f
.
open
(
QFile
.
ReadOnly
)
qss
=
str
(
f
.
readAll
(),
encoding
=
'utf-8'
)
template
=
QssTemplate
(
str
(
f
.
readAll
(),
encoding
=
'utf-8'
)
)
f
.
close
()
f
.
close
()
return
qss
mappings
=
{
c
.
value
:
c
.
name
()
for
c
in
ThemeColor
.
_member_map_
.
values
()}
return
template
.
safe_substitute
(
mappings
)
def
setStyleSheet
(
widget
,
file
,
theme
=
Theme
.
AUTO
,
register
=
True
):
def
setStyleSheet
(
widget
,
file
,
theme
=
Theme
.
AUTO
,
register
=
True
):
...
@@ -117,3 +128,82 @@ def setTheme(theme: Theme, save=False):
...
@@ -117,3 +128,82 @@ def setTheme(theme: Theme, save=False):
qconfig
.
set
(
qconfig
.
themeMode
,
theme
,
save
)
qconfig
.
set
(
qconfig
.
themeMode
,
theme
,
save
)
updateStyleSheet
()
updateStyleSheet
()
class
ThemeColor
(
Enum
):
""" Theme color type """
PRIMARY
=
"ThemeColorPrimary"
DARK_1
=
"ThemeColorDark1"
DARK_2
=
"ThemeColorDark2"
DARK_3
=
"ThemeColorDark3"
LIGHT_1
=
"ThemeColorLight1"
LIGHT_2
=
"ThemeColorLight2"
LIGHT_3
=
"ThemeColorLight3"
def
name
(
self
):
return
self
.
color
().
name
()
def
color
(
self
):
color
=
qconfig
.
get
(
qconfig
.
themeColor
)
# type:QColor
# transform color into hsv space
h
,
s
,
v
,
_
=
color
.
getHsvF
()
if
isDarkTheme
():
s
*=
0.84
v
=
1
if
self
==
self
.
DARK_1
:
v
*=
0.9
elif
self
==
self
.
DARK_2
:
s
*=
0.977
v
*=
0.82
elif
self
==
self
.
DARK_3
:
s
*=
0.95
v
*=
0.7
elif
self
==
self
.
LIGHT_1
:
s
*=
0.92
elif
self
==
self
.
LIGHT_2
:
s
*=
0.78
elif
self
==
self
.
LIGHT_3
:
s
*=
0.65
else
:
if
self
==
self
.
DARK_1
:
v
*=
0.75
elif
self
==
self
.
DARK_2
:
s
*=
1.05
v
*=
0.5
elif
self
==
self
.
DARK_3
:
s
*=
1.1
v
*=
0.4
elif
self
==
self
.
LIGHT_1
:
v
*=
1.05
elif
self
==
self
.
LIGHT_2
:
s
*=
0.75
v
*=
1.05
elif
self
==
self
.
LIGHT_3
:
s
*=
0.65
v
*=
1.05
return
QColor
.
fromHsvF
(
h
,
min
(
s
,
1
),
min
(
v
,
1
))
def
themeColor
():
""" get theme color """
return
ThemeColor
.
PRIMARY
.
color
()
def
setThemeColor
(
color
,
save
=
False
):
""" set theme color
Parameters
----------
color: QColor | Qt.GlobalColor | str
theme color
save: bool
whether to save to change to config file
"""
color
=
QColor
(
color
)
qconfig
.
set
(
qconfig
.
themeColor
,
color
,
save
=
save
)
updateStyleSheet
()
qfluentwidgets/components/dialog_box/color_dialog.py
浏览文件 @
57b407db
# coding:utf-8
# coding:utf-8
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QPoint
,
QRegExp
,
QSize
,
QCoreApplication
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QPoint
,
QRegExp
,
QSize
from
PyQt5.QtGui
import
(
QBrush
,
QColor
,
Q
MouseEvent
,
Q
Pixmap
,
from
PyQt5.QtGui
import
(
QBrush
,
QColor
,
QPixmap
,
QPainter
,
QPen
,
QIntValidator
,
QRegExpValidator
,
QIcon
)
QPainter
,
QPen
,
QIntValidator
,
QRegExpValidator
,
QIcon
)
from
PyQt5.QtWidgets
import
(
QApplication
,
QLabel
,
QLineEdit
,
QWidget
,
from
PyQt5.QtWidgets
import
(
QApplication
,
QLabel
,
QLineEdit
,
QWidget
,
QToolButton
,
Q
PushButton
,
Q
Frame
,
QVBoxLayout
)
QToolButton
,
QFrame
,
QVBoxLayout
)
from
...common.icon
import
Icon
,
getIconColor
from
...common.icon
import
getIconColor
from
...common.style_sheet
import
setStyleSheet
,
getStyleSheet
from
...common.style_sheet
import
setStyleSheet
,
getStyleSheet
from
..widgets
import
LineEditMenu
,
Slider
,
ScrollArea
from
..widgets
import
LineEditMenu
,
Slider
,
ScrollArea
,
PushButton
,
PrimaryPushButton
from
.mask_dialog_base
import
MaskDialogBase
from
.mask_dialog_base
import
MaskDialogBase
...
@@ -219,8 +219,8 @@ class ColorDialog(MaskDialogBase):
...
@@ -219,8 +219,8 @@ class ColorDialog(MaskDialogBase):
self
.
scrollWidget
=
QWidget
(
self
.
scrollArea
)
self
.
scrollWidget
=
QWidget
(
self
.
scrollArea
)
self
.
buttonGroup
=
QFrame
(
self
.
widget
)
self
.
buttonGroup
=
QFrame
(
self
.
widget
)
self
.
yesButton
=
Q
PushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
yesButton
=
Primary
PushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
cancelButton
=
Q
PushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
cancelButton
=
PushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
titleLabel
=
QLabel
(
title
,
self
.
scrollWidget
)
self
.
titleLabel
=
QLabel
(
title
,
self
.
scrollWidget
)
self
.
huePanel
=
HuePanel
(
color
,
self
.
scrollWidget
)
self
.
huePanel
=
HuePanel
(
color
,
self
.
scrollWidget
)
...
...
qfluentwidgets/components/dialog_box/dialog.py
浏览文件 @
57b407db
# coding:utf-8
# coding:utf-8
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QObject
,
QEvent
from
PyQt5.QtCore
import
Qt
,
pyqtSignal
,
QObject
,
QEvent
from
PyQt5.QtGui
import
QColor
from
PyQt5.QtGui
import
QColor
from
PyQt5.QtWidgets
import
QLabel
,
Q
PushButton
,
Q
Frame
,
QVBoxLayout
,
QHBoxLayout
from
PyQt5.QtWidgets
import
QLabel
,
QFrame
,
QVBoxLayout
,
QHBoxLayout
from
qframelesswindow
import
FramelessDialog
from
qframelesswindow
import
FramelessDialog
from
...common.auto_wrap
import
TextWrap
from
...common.auto_wrap
import
TextWrap
from
...common.style_sheet
import
setStyleSheet
from
...common.style_sheet
import
setStyleSheet
from
..widgets.button
import
PushButton
,
PrimaryPushButton
from
.mask_dialog_base
import
MaskDialogBase
from
.mask_dialog_base
import
MaskDialogBase
...
@@ -22,8 +23,8 @@ class Ui_MessageBox(QObject):
...
@@ -22,8 +23,8 @@ class Ui_MessageBox(QObject):
self
.
contentLabel
=
QLabel
(
content
,
parent
)
self
.
contentLabel
=
QLabel
(
content
,
parent
)
self
.
buttonGroup
=
QFrame
(
parent
)
self
.
buttonGroup
=
QFrame
(
parent
)
self
.
yesButton
=
Q
PushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
yesButton
=
Primary
PushButton
(
self
.
tr
(
'OK'
),
self
.
buttonGroup
)
self
.
cancelButton
=
Q
PushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
cancelButton
=
PushButton
(
self
.
tr
(
'Cancel'
),
self
.
buttonGroup
)
self
.
vBoxLayout
=
QVBoxLayout
(
parent
)
self
.
vBoxLayout
=
QVBoxLayout
(
parent
)
self
.
textLayout
=
QVBoxLayout
()
self
.
textLayout
=
QVBoxLayout
()
...
@@ -89,7 +90,6 @@ class Ui_MessageBox(QObject):
...
@@ -89,7 +90,6 @@ class Ui_MessageBox(QObject):
""" 设置层叠样式 """
""" 设置层叠样式 """
self
.
titleLabel
.
setObjectName
(
"titleLabel"
)
self
.
titleLabel
.
setObjectName
(
"titleLabel"
)
self
.
contentLabel
.
setObjectName
(
"contentLabel"
)
self
.
contentLabel
.
setObjectName
(
"contentLabel"
)
self
.
yesButton
.
setObjectName
(
'yesButton'
)
self
.
buttonGroup
.
setObjectName
(
'buttonGroup'
)
self
.
buttonGroup
.
setObjectName
(
'buttonGroup'
)
setStyleSheet
(
self
,
'dialog'
)
setStyleSheet
(
self
,
'dialog'
)
...
...
qfluentwidgets/components/navigation/navigation_widget.py
浏览文件 @
57b407db
...
@@ -6,6 +6,7 @@ from PyQt5.QtGui import QColor, QPainter, QPen, QIcon
...
@@ -6,6 +6,7 @@ from PyQt5.QtGui import QColor, QPainter, QPen, QIcon
from
PyQt5.QtWidgets
import
QWidget
from
PyQt5.QtWidgets
import
QWidget
from
...common.config
import
isDarkTheme
from
...common.config
import
isDarkTheme
from
...common.style_sheet
import
themeColor
from
...common.icon
import
drawIcon
from
...common.icon
import
drawIcon
from
...common.icon
import
FluentIcon
as
FIF
from
...common.icon
import
FluentIcon
as
FIF
...
@@ -113,8 +114,7 @@ class NavigationPushButton(NavigationWidget):
...
@@ -113,8 +114,7 @@ class NavigationPushButton(NavigationWidget):
painter
.
drawRoundedRect
(
self
.
rect
(),
5
,
5
)
painter
.
drawRoundedRect
(
self
.
rect
(),
5
,
5
)
# draw indicator
# draw indicator
color
=
QColor
(
41
,
247
,
255
)
if
isDarkTheme
()
else
QColor
(
0
,
153
,
188
)
painter
.
setBrush
(
themeColor
())
painter
.
setBrush
(
color
)
painter
.
drawRoundedRect
(
0
,
10
,
3
,
16
,
1.5
,
1.5
)
painter
.
drawRoundedRect
(
0
,
10
,
3
,
16
,
1.5
,
1.5
)
elif
self
.
isEnter
and
self
.
isEnabled
():
elif
self
.
isEnter
and
self
.
isEnabled
():
painter
.
setBrush
(
QColor
(
c
,
c
,
c
,
10
))
painter
.
setBrush
(
QColor
(
c
,
c
,
c
,
10
))
...
...
qfluentwidgets/components/settings/setting_card.py
浏览文件 @
57b407db
...
@@ -11,6 +11,7 @@ from ..widgets.combo_box import ComboBox
...
@@ -11,6 +11,7 @@ from ..widgets.combo_box import ComboBox
from
..widgets.switch_button
import
SwitchButton
,
IndicatorPosition
from
..widgets.switch_button
import
SwitchButton
,
IndicatorPosition
from
..widgets.slider
import
Slider
from
..widgets.slider
import
Slider
from
..widgets.icon_widget
import
IconWidget
from
..widgets.icon_widget
import
IconWidget
from
..widgets.button
import
HyperlinkButton
from
...common.style_sheet
import
setStyleSheet
from
...common.style_sheet
import
setStyleSheet
from
...common.config
import
qconfig
,
isDarkTheme
from
...common.config
import
qconfig
,
isDarkTheme
from
...common.icon
import
FluentIconBase
from
...common.icon
import
FluentIconBase
...
@@ -111,8 +112,6 @@ class SwitchSettingCard(SettingCard):
...
@@ -111,8 +112,6 @@ class SwitchSettingCard(SettingCard):
if
configItem
:
if
configItem
:
self
.
setChecked
(
qconfig
.
get
(
configItem
))
self
.
setChecked
(
qconfig
.
get
(
configItem
))
setStyleSheet
(
self
.
switchButton
,
'setting_card'
)
# add switch button to layout
# add switch button to layout
self
.
hBoxLayout
.
addWidget
(
self
.
switchButton
,
0
,
Qt
.
AlignRight
)
self
.
hBoxLayout
.
addWidget
(
self
.
switchButton
,
0
,
Qt
.
AlignRight
)
self
.
hBoxLayout
.
addSpacing
(
16
)
self
.
hBoxLayout
.
addSpacing
(
16
)
...
@@ -256,14 +255,7 @@ class HyperlinkCard(SettingCard):
...
@@ -256,14 +255,7 @@ class HyperlinkCard(SettingCard):
parent widget
parent widget
"""
"""
super
().
__init__
(
icon
,
title
,
content
,
parent
)
super
().
__init__
(
icon
,
title
,
content
,
parent
)
self
.
url
=
QUrl
(
url
)
self
.
linkButton
=
HyperlinkButton
(
url
,
text
,
self
)
self
.
linkButton
=
QPushButton
(
text
,
self
)
self
.
linkButton
.
setObjectName
(
'hyperlinkButton'
)
self
.
linkButton
.
setCursor
(
Qt
.
PointingHandCursor
)
self
.
linkButton
.
clicked
.
connect
(
lambda
i
:
QDesktopServices
.
openUrl
(
self
.
url
))
self
.
hBoxLayout
.
addWidget
(
self
.
linkButton
,
0
,
Qt
.
AlignRight
)
self
.
hBoxLayout
.
addWidget
(
self
.
linkButton
,
0
,
Qt
.
AlignRight
)
self
.
hBoxLayout
.
addSpacing
(
16
)
self
.
hBoxLayout
.
addSpacing
(
16
)
...
...
qfluentwidgets/components/widgets/__init__.py
浏览文件 @
57b407db
...
@@ -5,4 +5,5 @@ from .stacked_widget import PopUpAniStackedWidget, OpacityAniStackedWidget
...
@@ -5,4 +5,5 @@ from .stacked_widget import PopUpAniStackedWidget, OpacityAniStackedWidget
from
.switch_button
import
SwitchButton
,
IndicatorPosition
from
.switch_button
import
SwitchButton
,
IndicatorPosition
from
.state_tool_tip
import
StateToolTip
,
ToastToolTip
from
.state_tool_tip
import
StateToolTip
,
ToastToolTip
from
.scroll_area
import
ScrollArea
,
SmoothMode
,
SmoothScrollArea
,
SmoothScrollBar
from
.scroll_area
import
ScrollArea
,
SmoothMode
,
SmoothScrollArea
,
SmoothScrollBar
from
.tool_tip
import
ToolTip
,
ToolTipFilter
from
.tool_tip
import
ToolTip
,
ToolTipFilter
\ No newline at end of file
from
.button
import
PrimaryPushButton
,
PushButton
\ No newline at end of file
qfluentwidgets/components/widgets/button.py
0 → 100644
浏览文件 @
57b407db
# coding:utf-8
from
PyQt5.QtCore
import
QUrl
,
Qt
from
PyQt5.QtGui
import
QDesktopServices
from
PyQt5.QtWidgets
import
QPushButton
from
...common.style_sheet
import
setStyleSheet
class
PushButton
(
QPushButton
):
""" push button """
def
__init__
(
self
,
text
:
str
,
parent
=
None
):
super
().
__init__
(
text
=
text
,
parent
=
parent
)
setStyleSheet
(
self
,
'button'
)
class
PrimaryPushButton
(
PushButton
):
""" Primary color push button """
class
HyperlinkButton
(
QPushButton
):
""" Hyperlink button """
def
__init__
(
self
,
url
:
str
,
text
:
str
,
parent
=
None
):
super
().
__init__
(
text
,
parent
)
self
.
url
=
QUrl
(
url
)
self
.
clicked
.
connect
(
lambda
i
:
QDesktopServices
.
openUrl
(
self
.
url
))
setStyleSheet
(
self
,
'button'
)
self
.
setCursor
(
Qt
.
PointingHandCursor
)
\ No newline at end of file
qfluentwidgets/components/widgets/combo_box.py
浏览文件 @
57b407db
...
@@ -6,7 +6,7 @@ from PyQt5.QtWidgets import QAction, QPushButton, QWidget
...
@@ -6,7 +6,7 @@ from PyQt5.QtWidgets import QAction, QPushButton, QWidget
from
.menu
import
RoundMenu
from
.menu
import
RoundMenu
from
...common.config
import
isDarkTheme
from
...common.config
import
isDarkTheme
from
...common.icon
import
FluentIcon
as
FIF
from
...common.icon
import
FluentIcon
as
FIF
from
...common.style_sheet
import
setStyleSheet
from
...common.style_sheet
import
setStyleSheet
,
themeColor
class
ComboBox
(
QPushButton
):
class
ComboBox
(
QPushButton
):
...
@@ -132,7 +132,7 @@ class ComboBox(QPushButton):
...
@@ -132,7 +132,7 @@ class ComboBox(QPushButton):
menu
.
view
.
setMinimumWidth
(
self
.
width
())
menu
.
view
.
setMinimumWidth
(
self
.
width
())
menu
.
adjustSize
()
menu
.
adjustSize
()
# set the selected item
# set the selected item
menu
.
setDefaultAction
(
menu
.
menuActions
()[
self
.
currentIndex
()])
menu
.
setDefaultAction
(
menu
.
menuActions
()[
self
.
currentIndex
()])
...
@@ -202,11 +202,7 @@ class ComboBoxMenuItemWidget(QWidget):
...
@@ -202,11 +202,7 @@ class ComboBoxMenuItemWidget(QWidget):
return
return
painter
.
setPen
(
Qt
.
NoPen
)
painter
.
setPen
(
Qt
.
NoPen
)
if
isLight
:
painter
.
setBrush
(
themeColor
())
painter
.
setBrush
(
QColor
(
0
,
159
,
170
))
else
:
painter
.
setBrush
(
QColor
(
41
,
247
,
255
))
painter
.
drawRoundedRect
(
0
,
8
,
3
,
16
,
1.5
,
1.5
)
painter
.
drawRoundedRect
(
0
,
8
,
3
,
16
,
1.5
,
1.5
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录