Free AIA: Dark Mode Toggle App In Kodular 2026



Hello everyone! Welcome back to Kodular Free AIA. This is Hifza, and today we're sharing a Dark Mode Toggle App made in Kodular, with the full project file (.aia) free to download.

Dark mode is one of the most requested features in any Android app. Users love it at night, it is easier on the eyes, and it makes your app look modern. The good news is that you don't need any extension to add it in Kodular. With a few color blocks, one global variable, a procedure and TinyDB, you can build a light/dark theme switch that even remembers the user's choice after the app is closed.

This tutorial is perfect for beginners. Every block is explained step by step, and the free AIA at the end matches this post exactly, so you can import it and compare.

What Does the Dark Mode App Do?

The app has a single screen with a card in the middle and one button below it:

  • When the app opens for the first time, it shows the light theme (white background, grey card, indigo button).
  • Tapping "Switch to Dark Mode" turns the screen dark (#121212), the card dark grey, the text white, and the button purple.
  • Tapping the button again ("Switch to Light Mode") brings the light theme back.
  • The choice is saved in TinyDB. Close the app, open it again, and it starts in the same mode you left it in.

Along the way you will learn how to use color blocks, a true/false global variable, a procedure that styles many components at once, and the Screen1.Initialize event to load saved settings. These are the same skills you will use for theme settings in bigger apps.

Designer: Components Used

Here is the full component list. All of them are built-in Kodular components, so no extensions and no API keys are needed.

  • Screen1: Title = Dark Mode App, AlignHorizontal = Center, AlignVertical = Center, BackgroundColor = White.
  • CardArrangement (VerticalArrangement): Width = 90 percent, AlignHorizontal = Center, BackgroundColor = #F2F2F2.
    • TitleLabel (Label): Text = Dark Mode Demo, FontSize = 24, FontBold = checked, TextAlignment = Center, TextColor = #212121, Width = Fill parent.
    • InfoLabel (Label): Text = Tap the button to switch between light and dark mode. Your choice is saved with TinyDB, so the app remembers it next time., FontSize = 16, TextAlignment = Center, TextColor = #555555, Width = Fill parent.
    • ModeLabel (Label): Text = Current mode: Light, FontSize = 18, FontBold = checked, TextAlignment = Center, TextColor = #3F51B5, Width = Fill parent.
  • ToggleButton (Button): Text = Switch to Dark Mode, Width = 70 percent, Shape = Rounded, FontBold = checked, FontSize = 16, BackgroundColor = #3F51B5, TextColor = White.
  • TinyDB1 (TinyDB, non-visible): default Namespace.

Tip: give your components clear names like ToggleButton and ModeLabel instead of Button1 and Label3. It makes the Blocks editor much easier to read.

Blocks Explained Step by Step

The logic is split into four parts: one global variable, two events and one procedure.

1. The global variable

initialize global isDark to  false

isDark is a true/false flag. When it is true the app shows the dark theme, when it is false it shows the light theme.

2. Load the saved theme when the app opens

when Screen1.Initialize
do  set global isDark to  call TinyDB1.GetValue
                               tag                  "isDark"
                               valueIfTagNotThere   false
    call applyTheme

When the screen starts, we read the tag "isDark" from TinyDB. If the user has never pressed the button, the tag does not exist yet, so TinyDB returns the default value false and the app opens in light mode. Then we call the applyTheme procedure to paint the screen.

3. Toggle the theme when the button is clicked

when ToggleButton.Click
do  set global isDark to  not  get global isDark
    call TinyDB1.StoreValue
         tag           "isDark"
         valueToStore  get global isDark
    call applyTheme

The not block (from the Logic drawer) flips the value: true becomes false and false becomes true. We save the new value in TinyDB right away, so the choice survives an app restart, and then call applyTheme again.

4. The applyTheme procedure

to applyTheme
do  if  get global isDark
    then  set Screen1.BackgroundColor         to  #121212
          set CardArrangement.BackgroundColor to  #1E1E1E
          set TitleLabel.TextColor            to  #FFFFFF
          set InfoLabel.TextColor             to  #B0B0B0
          set ModeLabel.Text                  to  "Current mode: Dark"
          set ModeLabel.TextColor             to  #BB86FC
          set ToggleButton.Text               to  "Switch to Light Mode"
          set ToggleButton.BackgroundColor    to  #BB86FC
          set ToggleButton.TextColor          to  #000000
    else  set Screen1.BackgroundColor         to  #FFFFFF
          set CardArrangement.BackgroundColor to  #F2F2F2
          set TitleLabel.TextColor            to  #212121
          set InfoLabel.TextColor             to  #555555
          set ModeLabel.Text                  to  "Current mode: Light"
          set ModeLabel.TextColor             to  #3F51B5
          set ToggleButton.Text               to  "Switch to Dark Mode"
          set ToggleButton.BackgroundColor    to  #3F51B5
          set ToggleButton.TextColor          to  #FFFFFF

This is the heart of the app. Instead of repeating all these color blocks in two places, we put them in one procedure and call it from both events. The if/else block checks isDark and sets every color for the matching theme.

To make a custom color block, drag any color block from the Colors drawer and click on its color to pick a new one, or use the make color block with red, green and blue values. The dark colors here follow Google's Material dark theme: #121212 for the background, a slightly lighter #1E1E1E for surfaces, and a soft purple (#BB86FC) as the accent.

If you are new to saving data, read our full Kodular TinyDB Tutorial, which explains tags, StoreValue and GetValue in detail.



How to Import the AIA into Kodular

  1. Download DarkModeApp.aia from the download button below.
  2. Open Kodular Creator and sign in.
  3. Go to Projects → Import project (.aia) from my computer.
  4. Choose the downloaded DarkModeApp.aia file and click Import.
  5. Open the project, then test it with the Kodular Companion app or export the APK.

Tip: TinyDB keeps its data on the device, so to see the "first launch" light mode again during testing, clear the app's data or add a temporary TinyDB1.ClearAll block.

Common Mistakes

  • Forgetting to call applyTheme in Screen1.Initialize. The value is loaded, but the screen stays light until the button is pressed.
  • Using different tag names. "isDark" in StoreValue and "isdark" in GetValue are two different tags. TinyDB tags are case-sensitive, so copy the exact text.
  • Saving before flipping. If you call StoreValue before the not block, you save the old theme instead of the new one.
  • Missing a component in the procedure. If you add a new label later and forget to set its TextColor, it will show dark text on a dark background. Add every new component to both the then and else parts.
  • Low contrast colors. Pure black text on #121212 is unreadable. Always test both themes on a real phone.

Ideas to Extend the App

  • Use a Switch instead of a Button. Kodular's Switch component has a Clicked event that returns whether it is checked, which is a natural fit for a dark mode setting.
  • Apply the theme to every screen. Because the value lives in TinyDB, any other screen can read "isDark" in its own Initialize event. Our Kodular Splash Screen & Multiple Screens tutorial shows how to work with more than one screen.
  • Add a third "Blue" or "Sepia" theme by saving a text value (like "light", "dark", "blue") instead of true/false.
  • Follow the time of day with the Clock component, for example switching to dark mode automatically after 7 PM.
  • Combine it with a real app. Add the same theme procedure to our To-Do List App and your users get a night-friendly task list.

Download Free AIA:

Download Link 2 (Google Drive)

Download

Conclusion

That's it! You now have a working Dark Mode Toggle App in Kodular that switches themes with one tap and remembers the user's choice with TinyDB. The same pattern (a global flag, one theme procedure, and TinyDB) works for any setting you want to save, from font size to language.

Did the AIA import correctly for you? Which theme colors did you choose? Tell us in the comments below, and let us know which Kodular app you want us to build next. Thanks for reading, and happy app building! 🌙

Post a Comment

Previous Post Next Post