Android Code Snippet Light Theme for B4XDialogs

First you have to use the code below to set your dialog variable to Light Theme:
B4X:
Sub SetLightThemeDialog(dialog As B4XDialog)
    dialog.BackgroundColor = Colors.White
    dialog.ButtonsColor = Colors.White
    dialog.BorderColor = Colors.Gray
    dialog.ButtonsTextColor = 0xFF007DC3
End Sub

Then you can use the others codes whenever you need:
B4X:
Sub SetLightThemeList(list As B4XListTemplate)
    Dim TextColor As Int = 0xFF5B5B5B
    list.CustomListView1.sv.ScrollViewInnerPanel.Color = 0xFFDFDFDF
    list.CustomListView1.sv.Color = Colors.White
    list.CustomListView1.DefaultTextBackgroundColor = Colors.White
    list.CustomListView1.DefaultTextColor = TextColor
End Sub

4.png


B4X:
Sub SetLightThemeInput(input As B4XInputTemplate)
    Dim TextColor As Int = 0xFF5B5B5B
    input.TextField1.TextColor = TextColor
    input.lblTitle.TextColor = TextColor
    input.SetBorderColor(TextColor, Colors.Red)
End Sub

1.png


B4X:
Sub SetLightThemeSearch(search As B4XSearchTemplate)
    Dim TextColor As Int = 0xFF5B5B5B
    search.SearchField.TextField.TextColor = TextColor
    search.SearchField.NonFocusedHintColor = TextColor
    search.CustomListView1.sv.ScrollViewInnerPanel.Color = 0xFFDFDFDF
    search.CustomListView1.sv.Color = Colors.White
    search.CustomListView1.DefaultTextBackgroundColor = Colors.White
    search.CustomListView1.DefaultTextColor = TextColor
    If search.SearchField.lblV.IsInitialized Then search.SearchField.lblV.TextColor = TextColor
    If search.SearchField.lblClear.IsInitialized Then search.SearchField.lblClear.TextColor = TextColor
End Sub

3.png


B4X:
Sub SetLightThemeDate(datetemplate As B4XDateTemplate)
    Dim TextColor As Int = 0xFF5B5B5B
    datetemplate.DaysInWeekColor = Colors.Black
    datetemplate.SelectedColor = 0xFF39D7CE
    datetemplate.HighlightedColor = 0xFF00CEFF
    datetemplate.DaysInMonthColor = TextColor
    datetemplate.lblMonth.TextColor = TextColor
    datetemplate.lblYear.TextColor = TextColor
    datetemplate.SelectedColor = 0xFFFFA761
    For Each x As B4XView In Array(datetemplate.btnMonthLeft, datetemplate.btnMonthRight, datetemplate.btnYearLeft, datetemplate.btnYearRight)
        x.Color = Colors.Transparent
    Next
End Sub

2.png
 
Last edited:

mmanso

Active Member
Licensed User
Hi there,

Thanks for this. Since I'll be using it on a B4A and B4J project, here's the code for multi-platform:

B4X:
Sub SetLightThemeDialog(dialog As B4XDialog)
    dialog.BackgroundColor = xui.Color_White
    dialog.ButtonsColor = xui.Color_White
    dialog.BorderColor = xui.Color_Gray
    dialog.ButtonsTextColor = xui.Color_ARGB(0xFF, 0x00, 0x7D, 0xC3)   
End Sub

Sub SetLightThemeList(list As B4XListTemplate)
    Dim TextColor As Int = xui.Color_ARGB(0xFF, 0x5B, 0x5B, 0x5B)
    list.CustomListView1.sv.ScrollViewInnerPanel.Color = xui.Color_ARGB(0xFF, 0xDF, 0xDF, 0xDF)
    list.CustomListView1.sv.Color = xui.Color_White
    list.CustomListView1.DefaultTextBackgroundColor = xui.Color_White
    list.CustomListView1.DefaultTextColor = TextColor
End Sub

Sub SetLightThemeInput(input As B4XInputTemplate)
    Dim TextColor As Int = xui.Color_ARGB(0xFF, 0x5B, 0x5B, 0x5B)
    input.TextField1.TextColor = TextColor
    input.lblTitle.TextColor = TextColor
    input.SetBorderColor(TextColor, xui.Color_Red)
End Sub

Sub SetLightThemeSearch(search As B4XSearchTemplate)
    Dim TextColor As Int = xui.Color_ARGB(0xFF, 0x5B, 0x5B, 0x5B)
    search.SearchField.TextField.TextColor = TextColor
    search.SearchField.NonFocusedHintColor = TextColor
    search.CustomListView1.sv.ScrollViewInnerPanel.Color = xui.Color_ARGB(0xFF, 0xDF, 0xDF, 0xDF)
    search.CustomListView1.sv.Color = xui.Color_White
    search.CustomListView1.DefaultTextBackgroundColor = xui.Color_White
    search.CustomListView1.DefaultTextColor = TextColor
    If search.SearchField.lblV.IsInitialized Then search.SearchField.lblV.TextColor = TextColor
    If search.SearchField.lblClear.IsInitialized Then search.SearchField.lblClear.TextColor = TextColor
End Sub

Sub SetLightThemeDate(datetemplate As B4XDateTemplate)
    Dim TextColor As Int = xui.Color_ARGB(0xFF, 0x5B, 0x5B, 0x5B)
    datetemplate.DaysInWeekColor = xui.Color_Black
    datetemplate.SelectedColor = xui.Color_ARGB(0xFF, 0x39, 0xD7, 0xCE)
    datetemplate.HighlightedColor = xui.Color_ARGB(0xFF, 0x00, 0xCE, 0xFF)
    datetemplate.DaysInMonthColor = TextColor
    datetemplate.lblMonth.TextColor = TextColor
    datetemplate.lblYear.TextColor = TextColor
    datetemplate.SelectedColor = xui.Color_ARGB(0xFF, 0xFF, 0xA7, 0x61)
    For Each x As B4XView In Array(datetemplate.btnMonthLeft, datetemplate.btnMonthRight, datetemplate.btnYearLeft, datetemplate.btnYearRight)
        x.Color = xui.Color_Transparent
    Next
End Sub

Hope it's useful.
 
Top