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) => {
|
||||
return acc + character.charCodeAt(0)
|
||||
}, 0)
|
||||
switch (totalSum % 5) {
|
||||
switch (totalSum % 6) {
|
||||
case 0:
|
||||
return Color.mPrimary
|
||||
return [Color.mPrimary, Color.mOnPrimary]
|
||||
case 1:
|
||||
return Color.mSecondary
|
||||
return [Color.mSecondary, Color.mOnSecondary]
|
||||
case 2:
|
||||
return Color.mTertiary
|
||||
return [Color.mTertiary, Color.mOnTertiary]
|
||||
case 3:
|
||||
return Color.mError
|
||||
return [Color.mError, Color.mOnError]
|
||||
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
|
||||
height: Style.baseWidgetSize * 1.15 * scaling
|
||||
radius: Style.radiusL * scaling
|
||||
color: root.getWidgetColor(modelData)
|
||||
color: root.getWidgetColor(modelData)[0]
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
|
||||
|
|
@ -162,7 +164,7 @@ NBox {
|
|||
NText {
|
||||
text: modelData.id
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
color: Color.mOnPrimary
|
||||
color: root.getWidgetColor(modelData)[1]
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
Layout.preferredWidth: 80 * scaling
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ NBox {
|
|||
|
||||
// Centralized service
|
||||
readonly property bool hasPP: PowerProfileService.available
|
||||
|
||||
|
||||
RowLayout {
|
||||
id: powerRow
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import qs.Widgets
|
|||
NBox {
|
||||
id: root
|
||||
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
anchors.left: parent.left
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ NBox {
|
|||
|
||||
property real spacing: 0
|
||||
|
||||
|
||||
RowLayout {
|
||||
id: utilRow
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue