mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-04-19 15:27:40 +00:00
Dark mode support
This commit is contained in:
parent
be78865368
commit
535b3add4d
1 changed files with 10 additions and 8 deletions
|
@ -8,6 +8,8 @@ const today = new Date()
|
||||||
let width;
|
let width;
|
||||||
const h = 5
|
const h = 5
|
||||||
const debug = false
|
const debug = false
|
||||||
|
const backgroundColor = Color.dynamic(Color.white(), new Color('#222', 1.0))
|
||||||
|
const textColor = Color.dynamic(Color.black(), Color.white())
|
||||||
|
|
||||||
if (config.widgetFamily === 'small') {
|
if (config.widgetFamily === 'small') {
|
||||||
width = 200
|
width = 200
|
||||||
|
@ -287,12 +289,12 @@ if (!orderDetails) {
|
||||||
const remainingDays = getTimeRemaining(deliveryDate).days + 1;
|
const remainingDays = getTimeRemaining(deliveryDate).days + 1;
|
||||||
|
|
||||||
widget.setPadding(10, 10, 10, 10)
|
widget.setPadding(10, 10, 10, 10)
|
||||||
widget.backgroundColor = Color.white()
|
widget.backgroundColor = backgroundColor
|
||||||
widget.url = orderDetails.widgetURL
|
widget.url = orderDetails.widgetURL
|
||||||
|
|
||||||
const headlineText = widget.addText(' Order Status')
|
const headlineText = widget.addText(' Order Status')
|
||||||
headlineText.font = Font.regularSystemFont(14)
|
headlineText.font = Font.regularSystemFont(14)
|
||||||
headlineText.textColor = Color.black()
|
headlineText.textColor = textColor
|
||||||
headlineText.centerAlignText()
|
headlineText.centerAlignText()
|
||||||
|
|
||||||
widget.addSpacer(5)
|
widget.addSpacer(5)
|
||||||
|
@ -311,7 +313,7 @@ if (!orderDetails) {
|
||||||
|
|
||||||
const itemNameText = rightProductStack.addText(itemName)
|
const itemNameText = rightProductStack.addText(itemName)
|
||||||
itemNameText.font = Font.regularSystemFont(10)
|
itemNameText.font = Font.regularSystemFont(10)
|
||||||
itemNameText.textColor = Color.black()
|
itemNameText.textColor = textColor
|
||||||
itemNameText.minimumScaleFactor = 0.5
|
itemNameText.minimumScaleFactor = 0.5
|
||||||
itemNameText.lineLimit = 2
|
itemNameText.lineLimit = 2
|
||||||
|
|
||||||
|
@ -322,7 +324,7 @@ if (!orderDetails) {
|
||||||
|
|
||||||
const remainingDayText = widget.addText(remainingDays + ' ' + postFix)
|
const remainingDayText = widget.addText(remainingDays + ' ' + postFix)
|
||||||
remainingDayText.font = Font.regularSystemFont(26)
|
remainingDayText.font = Font.regularSystemFont(26)
|
||||||
remainingDayText.textColor = Color.black()
|
remainingDayText.textColor = textColor
|
||||||
remainingDayText.centerAlignText()
|
remainingDayText.centerAlignText()
|
||||||
remainingDayText.minimumScaleFactor = 0.5
|
remainingDayText.minimumScaleFactor = 0.5
|
||||||
|
|
||||||
|
@ -344,7 +346,7 @@ if (!orderDetails) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
statusText = progressStack.addText(itemStatusTracker['d']['currentStatus'])
|
statusText = progressStack.addText(itemStatusTracker['d']['currentStatus'])
|
||||||
}
|
}
|
||||||
statusText.textColor = Color.black()
|
statusText.textColor = textColor
|
||||||
statusText.font = Font.regularSystemFont(8)
|
statusText.font = Font.regularSystemFont(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,14 +356,14 @@ if (!orderDetails) {
|
||||||
footerStack.layoutHorizontally()
|
footerStack.layoutHorizontally()
|
||||||
|
|
||||||
const orderDateText = footerStack.addText(orderDate.toLocaleDateString())
|
const orderDateText = footerStack.addText(orderDate.toLocaleDateString())
|
||||||
orderDateText.textColor = Color.black()
|
orderDateText.textColor = textColor
|
||||||
orderDateText.font = Font.regularSystemFont(8)
|
orderDateText.font = Font.regularSystemFont(8)
|
||||||
orderDateText.lineLimit = 1
|
orderDateText.lineLimit = 1
|
||||||
|
|
||||||
footerStack.addSpacer()
|
footerStack.addSpacer()
|
||||||
|
|
||||||
const deliveryDateText = footerStack.addText(deliveryDate.toLocaleDateString())
|
const deliveryDateText = footerStack.addText(deliveryDate.toLocaleDateString())
|
||||||
deliveryDateText.textColor = Color.black()
|
deliveryDateText.textColor = textColor
|
||||||
deliveryDateText.font = Font.regularSystemFont(8)
|
deliveryDateText.font = Font.regularSystemFont(8)
|
||||||
deliveryDateText.lineLimit = 1
|
deliveryDateText.lineLimit = 1
|
||||||
} else {
|
} else {
|
||||||
|
@ -403,7 +405,7 @@ if (!orderDetails) {
|
||||||
|
|
||||||
const fallbackText = fallbackTextStack.addText(text)
|
const fallbackText = fallbackTextStack.addText(text)
|
||||||
fallbackText.font = Font.regularSystemFont(14)
|
fallbackText.font = Font.regularSystemFont(14)
|
||||||
fallbackText.textColor = Color.black()
|
fallbackText.textColor = textColor
|
||||||
fallbackText.minimumScaleFactor = 0.5
|
fallbackText.minimumScaleFactor = 0.5
|
||||||
fallbackText.lineLimit = 1
|
fallbackText.lineLimit = 1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue