Search Documentation

Search guides, functions, classes, interfaces, and more

Splash theming & shared params

Splash and miniapps share the same WebView localStorage. Theme uses the existing miniapp key; optional non-theme params use a separate bag.

Keys

KeyWho writesWho readsPurpose
themeMiniapp: moby.app.set_theme (mirrors via moby.splash.theme)Splash: splash.theme.*Splash background (background.splash)
mobyapps.splashMiniapp: moby.splash.paramsSplash: splash.params.getApp-defined params only — not theme

Do not nest theme inside mobyapps.splash.

Flow

  1. Miniapp calls set_theme (native + localStorage.theme) and optionally moby.splash.params.merge(...).
  2. On the next cold start, splash calls splash.theme.apply() and optionally splash.params.get().

Native must use the same WebView storage partition for splash and miniapps (FR-SP-08).

Miniapp side (@mobyapps/sdk)

import { moby } from '@mobyapps/sdk'

// Theme → native + localStorage.theme (preferred)
await moby.app.set_theme({
  style: 'light',
  background: {
    dark: '#0b0b0b',
    light: '#ffffff',
    splash: '#112233', // used by splash on next cold start
  },
})

// Read back what splash will see
const stored = moby.splash.theme.get()
console.log(stored?.background.splash)

// Storage-only theme write (no bridge) — rare; prefer set_theme
moby.splash.theme.set({
  style: 'dark',
  background: { dark: '#000000', light: '#ffffff', splash: '#1a1a2e' },
})

// Non-theme params bag (does not touch localStorage.theme)
moby.splash.params.merge({
  locale: 'ru',
  show_progress: true,
})
const bag = moby.splash.params.get()
CallBridge / nativelocalStorage.theme
moby.app.set_theme(...)YesYes
moby.splash.theme.set(...)NoYes only

Splash side (@mobyapps/splash only)

// src/main.ts — after splash.js; no @mobyapps/sdk

splash.theme.apply() // #splash_el + --splash-bg; fallback #ffffff

const hex = splash.theme.background()
const full = splash.theme.get() // null if missing/corrupt

const params = splash.params.get()
if (params?.locale === 'ru') {
  // customize copy / assets
}

Prefer splash.theme.apply() over hand-parsing localStorage.theme.

  • Spec: splash platform FR-SP-07…11 (docs/spec/splash/splash-platform.md)
  • SDK L1: docs/spec/sdk/splash-shared-params.md
  • Wire API: @mobyapps/splashSPLASH_API.md
  • Bridge: theme_settings.background.splash
  • Guide: Miniapp theming