修改三态颜色

This commit is contained in:
hewenfei 2023-06-27 16:19:40 +08:00
parent 3327d93700
commit a62416550d
4 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ MouseArea {
anchors.fill: parent anchors.fill: parent
radius: 4 radius: 4
useStyleTransparent: false useStyleTransparent: false
paletteRole: Palette.Light
alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00 alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
ToolTip.visible: content.textTruncated && control.containsMouse ToolTip.visible: content.textTruncated && control.containsMouse
ToolTip.text: name ToolTip.text: name

View File

@ -18,12 +18,11 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.12
import AppControls2 1.0 as AppControls2 import AppControls2 1.0 as AppControls2
import org.ukui.menu.core 1.0 import org.ukui.menu.core 1.0
AppControls2.StyleBackground { AppControls2.StyleBackground {
paletteRole: Palette.Window
radius: 12 radius: 12
property alias header: appPageHeader property alias header: appPageHeader
property alias content: appPageContent property alias content: appPageContent

View File

@ -56,6 +56,8 @@ QColor ThemePalette::paletteColor(Palette::ColorRole colorRole, Palette::ColorGr
return base(colorGroup); return base(colorGroup);
case Palette::Text: case Palette::Text:
return text(colorGroup); return text(colorGroup);
case Palette::BrightText:
return brightText(colorGroup);
case Palette::AlternateBase: case Palette::AlternateBase:
return alternateBase(colorGroup); return alternateBase(colorGroup);
case Palette::Button: case Palette::Button:
@ -111,6 +113,11 @@ QColor ThemePalette::text(Palette::ColorGroup colorGroup) const
return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Text); return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Text);
} }
QColor ThemePalette::brightText(Palette::ColorGroup colorGroup) const
{
return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::BrightText);
}
QColor ThemePalette::base(Palette::ColorGroup colorGroup) const QColor ThemePalette::base(Palette::ColorGroup colorGroup) const
{ {
return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Base); return QGuiApplication::palette().color(switchColorGroup(colorGroup), QPalette::Base);

View File

@ -38,7 +38,7 @@ public:
Q_ENUM(ColorGroup) Q_ENUM(ColorGroup)
enum ColorRole { enum ColorRole {
Window, WindowText, Base, Text, AlternateBase, Window, WindowText, Base, BrightText, Text, AlternateBase,
Button, ButtonText, Light, MidLight, Dark, Mid, Shadow, Button, ButtonText, Light, MidLight, Dark, Mid, Shadow,
Highlight, HighlightedText Highlight, HighlightedText
}; };
@ -80,6 +80,7 @@ public:
Q_INVOKABLE QColor windowText(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor windowText(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor base(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor base(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor text(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor text(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor brightText(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor alternateBase(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor alternateBase(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor button(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor button(Palette::ColorGroup colorGroup = Palette::Active) const;
Q_INVOKABLE QColor buttonText(Palette::ColorGroup colorGroup = Palette::Active) const; Q_INVOKABLE QColor buttonText(Palette::ColorGroup colorGroup = Palette::Active) const;