Bar widget editor: better colors + autoformatting
This commit is contained in:
parent
d8b12e6d6b
commit
719f5a20e7
4 changed files with 11 additions and 12 deletions
|
|
@ -41,17 +41,19 @@ NBox {
|
||||||
const totalSum = JSON.stringify(widget).split('').reduce((acc, character) => {
|
const totalSum = JSON.stringify(widget).split('').reduce((acc, character) => {
|
||||||
return acc + character.charCodeAt(0)
|
return acc + character.charCodeAt(0)
|
||||||
}, 0)
|
}, 0)
|
||||||
switch (totalSum % 5) {
|
switch (totalSum % 6) {
|
||||||
case 0:
|
case 0:
|
||||||
return Color.mPrimary
|
return [Color.mPrimary, Color.mOnPrimary]
|
||||||
case 1:
|
case 1:
|
||||||
return Color.mSecondary
|
return [Color.mSecondary, Color.mOnSecondary]
|
||||||
case 2:
|
case 2:
|
||||||
return Color.mTertiary
|
return [Color.mTertiary, Color.mOnTertiary]
|
||||||
case 3:
|
case 3:
|
||||||
return Color.mError
|
return [Color.mError, Color.mOnError]
|
||||||
case 4:
|
case 4:
|
||||||
return Color.mOnSurface
|
return [Color.mOnSurface, Color.mSurface]
|
||||||
|
case 5:
|
||||||
|
return [Color.mOnSurfaceVariant, Color.mSurfaceVariant]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +131,7 @@ NBox {
|
||||||
width: widgetContent.implicitWidth + Style.marginL * scaling
|
width: widgetContent.implicitWidth + Style.marginL * scaling
|
||||||
height: Style.baseWidgetSize * 1.15 * scaling
|
height: Style.baseWidgetSize * 1.15 * scaling
|
||||||
radius: Style.radiusL * scaling
|
radius: Style.radiusL * scaling
|
||||||
color: root.getWidgetColor(modelData)
|
color: root.getWidgetColor(modelData)[0]
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
|
||||||
|
|
@ -162,7 +164,7 @@ NBox {
|
||||||
NText {
|
NText {
|
||||||
text: modelData.id
|
text: modelData.id
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
color: Color.mOnPrimary
|
color: root.getWidgetColor(modelData)[1]
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.preferredWidth: 80 * scaling
|
Layout.preferredWidth: 80 * scaling
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ NBox {
|
||||||
|
|
||||||
// Centralized service
|
// Centralized service
|
||||||
readonly property bool hasPP: PowerProfileService.available
|
readonly property bool hasPP: PowerProfileService.available
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: powerRow
|
id: powerRow
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ import qs.Widgets
|
||||||
NBox {
|
NBox {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ NBox {
|
||||||
|
|
||||||
property real spacing: 0
|
property real spacing: 0
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: utilRow
|
id: utilRow
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue