// A pill beside a name: the one fact about that thing which decides how to // read the rest of the row. // // StatusBadge { text: "Bluetooth"; tone: Theme.accent } // StatusBadge { text: "No reader"; tone: Theme.warn } // // It was born on the Sound page as SoundBadge, where nine outputs named after // their chipsets look alike in a list and which of them arrives over the // network, over Bluetooth, or is simply away in its case is what tells them // apart. That turned out to be the general shape -- an account that is // connected, a package that came from Flatpak, a shortcut that has been // changed -- so it lost the "Sound" and became the one pill the settings use. // // Always a single short token, always upper-cased here rather than by the // caller. A badge carrying a sentence is a detail line wearing a border. import QtQuick import qs.config Rectangle { id: root property string text: "" // The token the badge is drawn from -- cyan for network devices, the accent // for Bluetooth, muted for a device that is not present. property color tone: Theme.accent implicitWidth: label.implicitWidth + 14 implicitHeight: 17 radius: Theme.pillRadius color: Theme.alpha(root.tone, 0.10) border.width: 1 border.color: Theme.alpha(root.tone, 0.28) Text { id: label anchors.centerIn: parent text: root.text color: root.tone font.family: Theme.fontFamily font.pixelSize: Math.max(9, Theme.fontSizeSmall - 2) font.weight: Font.DemiBold font.capitalization: Font.AllUppercase font.letterSpacing: 0.5 } }