From 242298911c5b8979f249bf55c474cfcd5dc8baff Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Fri, 22 Dec 2023 15:19:19 -0500 Subject: [PATCH] Fix dialog palette --- playlet-app/src/source/Dialog.bs | 14 ++++++++++++++ playlet-lib/src/components/Dialog/DialogPalette.bs | 4 ++-- playlet-lib/src/components/Dialog/LoginDialog.bs | 2 +- playlet-lib/src/components/Dialog/SimpleDialog.bs | 2 +- .../InvidiousInstance/InvidiousInstanceSettings.bs | 2 ++ .../Screens/SettingsScreen/StringControl.bs | 2 ++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/playlet-app/src/source/Dialog.bs b/playlet-app/src/source/Dialog.bs index ed8ac028..0171097f 100644 --- a/playlet-app/src/source/Dialog.bs +++ b/playlet-app/src/source/Dialog.bs @@ -1,6 +1,7 @@ function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object) ' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later dialog = CreateObject("roSGNode", "StandardMessageDialog") + SetPalette(dialog) dialog.message = message dialog.bulletText = bulletText dialog.bottomMessage = bottomMessage @@ -15,6 +16,19 @@ function ShowErrorDialog(message as object, bulletText as object, bottomMessage m.top.getScene().dialog = dialog end function +function SetPalette(dialog as object) + palette = createObject("roSGNode", "RSGPalette") + palette.colors = { + DialogBackgroundColor: "#242424FF", + DialogFocusColor: "#CECECEFF", + DialogFocusItemColor: "#202020FF", + DialogSecondaryTextColor: "#F8F8F8FF", + DialogSecondaryItemColor: "0xFF1C30FF", + DialogTextColor: "#EEEEEEFF" + } + dialog.palette = palette +end function + function OnButtonSelected() m.top.getScene().dialog.close = true end function diff --git a/playlet-lib/src/components/Dialog/DialogPalette.bs b/playlet-lib/src/components/Dialog/DialogPalette.bs index 1d91eb2b..e5ec5d7a 100644 --- a/playlet-lib/src/components/Dialog/DialogPalette.bs +++ b/playlet-lib/src/components/Dialog/DialogPalette.bs @@ -1,4 +1,4 @@ -function SetPalette() +function SetPalette(dialog as object) palette = createObject("roSGNode", "RSGPalette") palette.colors = { DialogBackgroundColor: "#242424FF", @@ -8,5 +8,5 @@ function SetPalette() DialogSecondaryItemColor: "0xFF1C30FF", DialogTextColor: "#EEEEEEFF" } - m.top.palette = palette + dialog.palette = palette end function diff --git a/playlet-lib/src/components/Dialog/LoginDialog.bs b/playlet-lib/src/components/Dialog/LoginDialog.bs index 4991349d..15203f13 100644 --- a/playlet-lib/src/components/Dialog/LoginDialog.bs +++ b/playlet-lib/src/components/Dialog/LoginDialog.bs @@ -5,7 +5,7 @@ import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/Types.bs" function Init() - SetPalette() + SetPalette(m.top) m.urlLabel = m.top.findNode("urlLabel") m.qrCode = m.top.findNode("QrCodePoster") diff --git a/playlet-lib/src/components/Dialog/SimpleDialog.bs b/playlet-lib/src/components/Dialog/SimpleDialog.bs index e68a1342..9a818509 100644 --- a/playlet-lib/src/components/Dialog/SimpleDialog.bs +++ b/playlet-lib/src/components/Dialog/SimpleDialog.bs @@ -2,7 +2,7 @@ import "DialogPalette.bs" import "pkg:/source/utils/Types.bs" function Init() - SetPalette() + SetPalette(m.top) m.top.observeField("buttonSelected", FuncName(CloseDialog)) end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceSettings.bs b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceSettings.bs index 340bf329..d3daafe4 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceSettings.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceSettings.bs @@ -1,6 +1,7 @@ import "pkg:/components/Navigation/Navigation.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/source/utils/Types.bs" +import "pkg:/components/Dialog/DialogPalette.bs" function Init() m.textEditBox = m.top.findNode("textEditBox") @@ -77,6 +78,7 @@ end function function OnEditButtonSelected() keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog") + SetPalette(keyboardDialog) keyboardDialog.title = "Edit Instance" keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`] keyboardDialog.text = m.top.text diff --git a/playlet-lib/src/components/Screens/SettingsScreen/StringControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/StringControl.bs index ec6151b9..535ea243 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/StringControl.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/StringControl.bs @@ -1,5 +1,6 @@ import "pkg:/source/utils/FocusManagement.bs" import "pkg:/source/utils/Types.bs" +import "pkg:/components/Dialog/DialogPalette.bs" function Init() m.top.focusable = true @@ -65,6 +66,7 @@ end function function ShowEditKeyboard() keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog") + SetPalette(keyboardDialog) keyboardDialog.title = m.top.displayText keyboardDialog.message = [m.top.description] keyboardDialog.text = m.top.value