@amisi-mobile-starter/theme
@amisi-mobile-starter/theme builds defaultTheme from normalized @amisi-mobile-starter/config UI values and fixed font, spacing, and typography defaults.
Theme provider
ThemeProvider accepts children and optional theme?: ThemeConfig. Its initial colorScheme is system. It loads and saves light | dark | system under the secure-store key theme-color-scheme and synchronizes native Appearance when you select light or dark.
Hooks
ThemeProvider.
useTheme() returns theme, colorScheme, isDark, colors, setColorScheme, and toggleColorScheme. useColorScheme() returns only colorScheme, isDark, setColorScheme, and toggleColorScheme. useColors() returns the resolved ThemeColors object directly.
Although ThemeContextValue types setColorScheme as returning void, the implementation is asynchronous internally and callers should not rely on a returned persistence promise.
Theme shape
ThemeConfig contains:
colors.lightandcolors.darkfonts:primary,secondary,mono,useGoogleFontsspacing:xs,sm,md,lg,xl,2xlborderRadius:sm,md,lg,xl,fullshadows:color,sm,md,lgcontrols:sm,md,lgtypography.fontSize,typography.fontWeight, andtypography.lineHeight
ThemeColors object has primary, secondary, accent, background, surface, border, nested text.primary|secondary|muted, error, success, warning, and info.
Configure colors, radii, shadows, and controls in amisi.config.json at theme.ui.light, theme.ui.dark, theme.ui.radius, theme.ui.shadow, and theme.ui.controls.
Utility exports
lighten(color, amount) and darken(color, amount) return hex strings. alpha(color, opacity) returns a hexa string. getContrastColor(backgroundColor) returns #000000 for a light background or #ffffff otherwise.
getShadowStyle(theme, level) accepts sm | md | lg and returns a React Native ViewStyle using the configured shadow color and depth.