SetDarkTheme()
Enables or disables dark theme for the entire application. MaterialSB enables dark theme by default after initialization.
Syntax
MaterialSB::SetDarkTheme(State)
Parameters
| State | #True to enable dark theme, #False for light theme. |
Return Value
None.
Remarks
Dark theme is enabled by default when MaterialSB initializes. The theme is applied by setting the theme attribute on the document's root element.
Use GetDarkThemeState() to check the current theme state.
Example
Global themeSwitch
Procedure ToggleTheme()
Protected isDark
!v_isdark = v_themeswitch.checked;
MaterialSB::SetDarkTheme(isDark)
EndProcedure
Procedure Main(Success)
If Success
; Start with light theme instead of default dark
MaterialSB::SetDarkTheme(#False)
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12, 6)
MaterialSB::Card()
MaterialSB::CardContent()
MaterialSB::Append(MaterialSB::Header("Theme Settings", 4))
MaterialSB::Append(MaterialSB::Paragraph("Toggle between light and dark themes:"))
; Theme toggle switch
themeSwitch = MaterialSB::Switch("Light", "Dark")
MaterialSB::InputSetCallback(themeSwitch, @ToggleTheme())
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())