improve GlowPoint contrast

pull/2/head
Michail Vourlakos 7 years ago
parent fa1ef2f17d
commit 4692b87bb5

@ -52,6 +52,12 @@ Item{
roundCorners: true
showGlow: mimicPlasmaPanel ? false : root.showGlow
glow3D: root.glow3D
animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration)
location: plasmoid.location
glowOpacity: root.glowOpacity
contrastColor: root.appShadowColorSolid
opacity:{
if ( (!vertical && width <= glowFrame.size && !isActive)
|| (vertical && height <= glowFrame.size && !isActive))

@ -163,6 +163,7 @@ DragDrop.DropArea {
property int appShadowOpacity: (plasmoid.configuration.shadowOpacity/100) * 255
property int appShadowSize: enableShadows ? (0.4*root.iconSize) * (plasmoid.configuration.shadowSize/100) : 0
property string appShadowColor: "#" + decimalToHex(appShadowOpacity) + plasmoid.configuration.shadowColor
property string appShadowColorSolid: "#" + plasmoid.configuration.shadowColor
property int totalPanelEdgeSpacing: 0 //this is set by PanelBox
//FIXME: this is not needed any more probably

@ -21,6 +21,7 @@
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as Components
import org.kde.plasma.plasmoid 2.0
import QtGraphicalEffects 1.0
@ -28,37 +29,45 @@ Item{
// property string color
id: glowItem
property bool glow3D: true
property bool roundCorners: true
property bool showAttention: false
property bool showGlow: false
property int animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration)
property color attentionColor: colorScopePalette.negativeTextColor // "#ffff1717"
property int animation: 250
property int location: PlasmaCore.Types.BottomEdge
property real glowOpacity: 0.75
property color attentionColor: "red"
property color basicColor: "blue"
property color contrastColor: "#b0b0b0"
property color currentColor: glowItem.showAttention ? animationColorAlpha : basicColorAlpha
property color animationColor: "red" // it is used only internally for the animation
readonly property color basicColorAlpha: Qt.rgba(basicColor.r, basicColor.g, basicColor.b, glowOpacity)
readonly property color animationColorAlpha: Qt.rgba(animationColor.r, animationColor.g, animationColor.b, glowOpacity)
readonly property color contrastColorAlpha: Qt.rgba(contrastColor.r, contrastColor.g, contrastColor.b, Math.min(glowOpacity+0.4,1))
property color animationColor
property color currentColor: glowItem.showAttention ? animationColor : basicColor
readonly property bool isVertical: (location === PlasmaCore.Types.LeftEdge) || (location === PlasmaCore.Types.RightEdge)
readonly property bool isHorizontal: !isVertical
readonly property real glowOpacity: root.glowOpacity
Grid{
id: mainGlow
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
opacity: glowOpacity
visible: glowItem.showGlow
rows: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? 1 : 0
columns: plasmoid.formFactor === PlasmaCore.Types.Vertical ? 1 : 0
rows: isHorizontal ? 1 : 0
columns: isVertical ? 1 : 0
property int halfCorner: 3*glowFrame.size
property int fullCorner: 6*glowFrame.size
Item {
id: firstGlowCorner
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? mainGlow.halfCorner : mainGlow.fullCorner
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? mainGlow.fullCorner : mainGlow.halfCorner
width: isHorizontal ? mainGlow.halfCorner : mainGlow.fullCorner
height: isHorizontal ? mainGlow.fullCorner : mainGlow.halfCorner
clip: true
Item {
@ -70,9 +79,9 @@ Item{
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.07; color: "transparent" }
GradientStop { position: 0.07; color: glowItem.contrastColorAlpha }
GradientStop { position: 0.125; color: glowItem.currentColor }
GradientStop { position: 0.4; color: "transparent" }
GradientStop { position: 0.4; color: "transparent" }
GradientStop { position: 1; color: "transparent" }
}
}
@ -81,31 +90,31 @@ Item{
Item {
id:mainGlowPart
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? glowItem.width - glowFrame.size : mainGlow.fullCorner
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? mainGlow.fullCorner : glowItem.height - glowFrame.size
width: isHorizontal ? glowItem.width - glowFrame.size : mainGlow.fullCorner
height: isHorizontal ? mainGlow.fullCorner : glowItem.height - glowFrame.size
LinearGradient {
anchors.fill: parent
start: {
if (plasmoid.location === PlasmaCore.Types.BottomEdge)
if (location === PlasmaCore.Types.BottomEdge)
return Qt.point(0, 0);
else if (plasmoid.location === PlasmaCore.Types.TopEdge)
else if (location === PlasmaCore.Types.TopEdge)
return Qt.point(0, mainGlow.fullCorner);
else if (plasmoid.location === PlasmaCore.Types.LeftEdge)
else if (location === PlasmaCore.Types.LeftEdge)
return Qt.point(mainGlow.fullCorner, 0);
else if (plasmoid.location === PlasmaCore.Types.RightEdge)
else if (location === PlasmaCore.Types.RightEdge)
return Qt.point(0, 0);
return Qt.point(mainGlow.fullCorner, 0);
}
end: {
if (plasmoid.location === PlasmaCore.Types.BottomEdge)
if (location === PlasmaCore.Types.BottomEdge)
return Qt.point(0, mainGlow.fullCorner);
else if (plasmoid.location === PlasmaCore.Types.TopEdge)
else if (location === PlasmaCore.Types.TopEdge)
return Qt.point(0, 0);
else if (plasmoid.location === PlasmaCore.Types.LeftEdge)
else if (location === PlasmaCore.Types.LeftEdge)
return Qt.point(0,0);
else if (plasmoid.location === PlasmaCore.Types.RightEdge)
else if (location === PlasmaCore.Types.RightEdge)
return Qt.point(mainGlow.fullCorner, 0);
return Qt.point(0,0);
@ -115,15 +124,15 @@ Item{
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.08; color: "transparent" }
GradientStop { position: 0.37; color: glowItem.currentColor }
GradientStop { position: 0.49; color: "transparent" }
GradientStop { position: 0.43; color: glowItem.contrastColorAlpha }
}
}
}
Item {
id:lastGlowCorner
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? mainGlow.halfCorner : mainGlow.fullCorner
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? mainGlow.fullCorner : mainGlow.halfCorner
width: isHorizontal ? mainGlow.halfCorner : mainGlow.fullCorner
height: isHorizontal ? mainGlow.fullCorner : mainGlow.halfCorner
clip: true
Item {
@ -136,9 +145,9 @@ Item{
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.07; color: "transparent" }
GradientStop { position: 0.07; color: glowItem.contrastColorAlpha }
GradientStop { position: 0.125; color: glowItem.currentColor }
GradientStop { position: 0.4; color: "transparent" }
GradientStop { position: 0.4; color: "transparent"}
GradientStop { position: 1; color: "transparent" }
}
}
@ -146,7 +155,7 @@ Item{
states: [
State{
name: "*"
when: plasmoid.formFactor === PlasmaCore.Types.Horizontal
when: isHorizontal
AnchorChanges{
target:lastGlowCornerFull;
@ -155,7 +164,7 @@ Item{
},
State{
name: "vertical"
when: plasmoid.formFactor === PlasmaCore.Types.Vertical
when: isVertical
AnchorChanges{
target:lastGlowCornerFull;
@ -201,7 +210,7 @@ Item{
PropertyAnimation {
target: glowItem
property: "animationColor"
to: glowItem.attentionColor
to: glowItem.animationColor
duration: glowItem.animation
easing.type: Easing.InOutQuad
}
@ -218,34 +227,34 @@ Item{
}
Rectangle {
visible: glowItem.showGlow && root.glow3D
visible: glowItem.showGlow && glowItem.glow3D
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenterOffset: {
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal)
if (isHorizontal)
return 0;
else if (plasmoid.location === PlasmaCore.Types.LeftEdge)
else if (location === PlasmaCore.Types.LeftEdge)
return -glowItem.width / 7;
else if (plasmoid.location === PlasmaCore.Types.RightEdge)
else if (location === PlasmaCore.Types.RightEdge)
return glowItem.width / 7;
}
anchors.verticalCenterOffset: {
if (plasmoid.formFactor === PlasmaCore.Types.Vertical)
if (isVertical)
return 0;
else if (plasmoid.location === PlasmaCore.Types.BottomEdge)
else if (location === PlasmaCore.Types.BottomEdge)
return glowItem.height / 7;
else if (plasmoid.location === PlasmaCore.Types.TopEdge)
else if (location === PlasmaCore.Types.TopEdge)
return -glowItem.height / 7;
}
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? Math.max(mainGlowPart.width, shadow) : shadow
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? shadow : Math.max(mainGlowPart.height, shadow)
radius: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? height/2 : width/2
width: isHorizontal ? Math.max(mainGlowPart.width, shadow) : shadow
height: isHorizontal ? shadow : Math.max(mainGlowPart.height, shadow)
radius: isHorizontal ? height/2 : width/2
property int shadow: glowFrame.size / 3
color: root.appShadowColor
color: glowItem.contrastColorAlpha
opacity: 0.2
}
}

@ -192,6 +192,7 @@ Item {
property int appShadowSize: latteDock ? latteDock.appShadowSize : Math.ceil(0.12*iconSize)
property string appShadowColor: latteDock ? latteDock.appShadowColor : "#ff080808"
property string appShadowColorSolid: latteDock ? latteDock.appShadowColorSolid : "#ff080808"
property alias tasksCount: tasksModel.count
property alias hoveredIndex: icList.hoveredIndex

@ -66,6 +66,13 @@ Item{
basicColor: IsActive===true || (mainItemContainer.isGroupParent && mainItemContainer.hasShown)?
glowFrame.isActiveColor : glowFrame.notActiveColor
glow3D: root.glow3D
animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration)
location: plasmoid.location
glowOpacity: root.glowOpacity
contrastColor: root.appShadowColorSolid
attentionColor: colorScopePalette.negativeTextColor
roundCorners: true
showAttention: mainItemContainer.showAttention
showGlow: {
@ -77,8 +84,8 @@ Item{
return false;
}
opacity: (!mainItemContainer.hasActive && root.showPreviews
&& windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === mainItemContainer)) ? 0.4 : 1
// opacity: (!mainItemContainer.hasActive && root.showPreviews
// && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === mainItemContainer)) ? 0.4 : 1
property int stateWidth: mainItemContainer.isGroupParent ? (wrapper.regulatorWidth - secondPoint.width) : wrapper.regulatorWidth - spacer.width
property int stateHeight: mainItemContainer.isGroupParent ? wrapper.regulatorHeight - secondPoint.height : wrapper.regulatorHeight - spacer.height
@ -174,6 +181,12 @@ Item{
width: visible ? glowFrame.size : 0
height: width
glow3D: root.glow3D
animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration)
location: plasmoid.location
glowOpacity: root.glowOpacity
contrastColor: root.appShadowColorSolid
basicColor: state2Color //mainItemContainer.hasActive ? state2Color : state1Color
roundCorners: true
showGlow: root.showGlow && root.glowOption === Latte.Dock.GlowAll

Loading…
Cancel
Save