Docs
Design system
The Material 3 Expressive shapes, colour, type and motion behind Petal's interface.
1. Design Direction: Material 3 Expressive & LastWave Liquid Glass
Petal Browser implements Google's Material 3 Expressive design specification (androidx.compose.material3:material3:1.5.0-alpha22) paired with the LastWave Liquid Glass engine, prioritizing vibrant dynamic geometry, real backdrop blur, living visual hierarchy, playful spring animations, and tactile responsiveness.
2. Dynamic 35 Material 3 Expressive Shapes Catalog
Implemented in com.petal.browser.ui.theme.PetalMaterialShapes.kt using androidx.graphics.shapes.RoundedPolygon:
Every interactive chip, web shortcut pill, FAB, and dialog accent is mapped across 35 distinct geometric shapes:
CircleSquareSlantedArchSemiCircleOvalPillTriangleArrowFanDiamondClamShellPentagonGemSunnyVerySunnyCookie4SidedCookie6SidedCookie7SidedCookie9SidedCookie12SidedGhostishClover4LeafClover8LeafBurstSoftBurstBoomSoftBoomFlowerPuffyPuffyDiamondPixelCirclePixelTriangleBunHeart
The helper extension RoundedPolygon.toShape() renders smooth Compose-native vector paths with zero bitmap distortion.
3. LastWave Liquid Header Glass Engine
- Backdrop Blur & Refraction: On Android 12+ (API 31+), headers, sheets, and dialogs utilize real-time render effect backdrop blurs with customizable sheen intensity, specular highlights, and chromatic aberration.
- Glass Header Architecture (
PetalGlassHeaderLayout): The page content acts as the backdrop source while the header floats above it. Search rows, tab strips, and filters sit seamlessly inside the header'sbottomContentslot, eliminating content overlap and page jumps. - Hardware-Aware Fallback: Automatically falls back to high-contrast solid surfaces on low-end devices (
MotionGate.isLowEndDevice) or when disabled in Settings.
4. App Identity, Selectable App Icons & Themes
- Adaptive Icon Themes: Choose how Petal looks on your home screen in Settings > App Icon (Bloom, Classic Swirl, Tab Bloom, Petal P, Lens, Shield) with adaptive monochrome styling and dynamic wallpaper coloring.
- Dynamic Launch Splash Screens: Synchronized animated splash screens on Android 13+ with smooth exit transitions.
6. Color Palettes, AMOLED Pure Black & Typography Tokens
- Theme Definitions (
com.petal.browser.ui.theme.PetalTheme.kt):- Dynamic Palette: Extracts system wallpaper tones on Android 12+ (API 31+) via
dynamicLightColorSchemeanddynamicDarkColorScheme. - Fallback Palettes: Hand-crafted color harmonies including
Petal,Tide,Sakura,Emerald, andNord. - AMOLED Mode (
applyAmoled()): Replaces dark surfaces with true pitch black (#000000) across all elevation layers, saving battery life on OLED displays.
- Dynamic Palette: Extracts system wallpaper tones on Android 12+ (API 31+) via
- Motion & Spring Easing:
- Spring physics parameters:
dampingRatio = Spring.DampingRatioLowBouncy(0.75f) withstiffness = Spring.StiffnessMediumLow. - Emphasized transitions:
CubicBezierEasing(0.05f, 0.7f, 0.1f, 1.0f)over 350ms duration for enter and exit animations.
- Spring physics parameters:
- Tactile Waveform Haptics (
PetalHapticEngine.kt):- Synthesizes distinct vibration patterns (
CLICK,TICK,DOUBLE_CLICK,HEAVY_CLICK) mapped to address bar actions, swipe thresholds, and seek gestures.
- Synthesizes distinct vibration patterns (
7. Developer Checklist for New Screens
When building or updating any screen, sheet, dialog, or component in Petal, verify against this checklist:
- [ ] No Outlines/Borders: No
BorderStrokeorModifier.borderused for decoration. Borders only permitted for 2dp primary focus rings or selected tab thumbnails. - [ ] No Outlined Material 3 Components: No
OutlinedButton,OutlinedTextField, orOutlinedCard. Use tonal filled variants (TextField,FilledTonalButton,Card/Surface). - [ ] Unified Button Groups: Side-by-side buttons use
PetalConnectedButtonGrouporPetalChoiceButtonGroupwith 6dp spacing and 50dp/6dp corner morphing. - [ ] Standardized Shapes: Standard buttons use pills (
CircleShapeor 50dp); icon buttons use circles; cards use 16dp rounded corners. - [ ] No Hardcoded Hex Colors: All colors use
MaterialTheme.colorSchemetokens. - [ ] Transient Surfaces: Bottom sheets use
PetalSheet; dialogs usePetalDialogorPetalMaterialAlertDialog. - [ ] Touch Targets: All interactive elements maintain a minimum touch target of 48.dp.
- [ ] Accessibility & Ellipsis: Text labels have
maxLines = 1andTextOverflow.Ellipsiswhere bounded, with descriptive content descriptions. - [ ] Calm Motion: Transitions use
MotionScheme.expressive()or fast effects specs with no aggressive overshoot.