Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8TNMgnEa7Kia5Wcz2kyDx
55 lines
1.7 KiB
QML
55 lines
1.7 KiB
QML
import QtQuick
|
|
import QtQuick.Effects
|
|
import "."
|
|
|
|
// Bar-style pill chrome: rounded surface, border, optional colored glow.
|
|
// Children are centered in an internal Row - place them directly as this
|
|
// component's children, same as putting them in a Row.
|
|
Rectangle {
|
|
id: pill
|
|
|
|
property color tint: Theme.colors.border
|
|
property bool glow: false
|
|
// How strongly `tint` is mixed into the base surface color, so each
|
|
// pill reads as its own tinted background instead of one flat surface
|
|
// color with only the border/glow varying.
|
|
property real tintStrength: 0.35
|
|
default property alias content: contentRow.data
|
|
|
|
function blend(base, mix, amount) {
|
|
return Qt.rgba(
|
|
base.r + (mix.r - base.r) * amount,
|
|
base.g + (mix.g - base.g) * amount,
|
|
base.b + (mix.b - base.b) * amount,
|
|
base.a
|
|
);
|
|
}
|
|
|
|
implicitWidth: contentRow.implicitWidth + Theme.geometry.padding * 2
|
|
implicitHeight: contentRow.implicitHeight + Theme.geometry.padding
|
|
height: implicitHeight
|
|
radius: Theme.geometry.pillRadius
|
|
color: blend(Theme.colors.surface, tint, tintStrength)
|
|
border.color: tint
|
|
border.width: 1
|
|
|
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationNormal } }
|
|
|
|
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
|
|
|
layer.enabled: glow
|
|
layer.effect: MultiEffect {
|
|
shadowEnabled: true
|
|
shadowColor: pill.tint
|
|
shadowOpacity: Theme.elevation.low.opacity
|
|
shadowBlur: Theme.elevation.low.blur
|
|
shadowVerticalOffset: 1
|
|
}
|
|
|
|
Row {
|
|
id: contentRow
|
|
anchors.centerIn: parent
|
|
spacing: Theme.geometry.spacing
|
|
}
|
|
}
|