Camouflage — Overview
Concept
Camouflage is a component library where what a component is stays fixed and how it looks comes from a swappable Skin plus a Theme. A new app gets a new Theme, not new components.
The problem
Every new app starts with a Figma file that has its own design system. The usual answer is to rebuild the same components again: PrimaryButton, AppTextField, BrandCard. Each time the logic (state, focus, accessibility, callbacks) is written again, even though only the look changed.
Existing toolkits make this worse in different ways:
- Flutter ships Material and Cupertino, but they are two separate widget sets (
ElevatedButtonvsCupertinoButton). Switching means changing call sites. - Jetpack Compose lets you build a custom design system on
compose.foundationwith your ownCompositionLocals. Butmaterial3components read onlyMaterialTheme, there is no built-in Cupertino, and there is no "skin switch". A custom look usually means rewriting the component.
Camouflage separates the three concerns, so the component is written once.
The three concepts
| Concept | Owns | Changes when… | Example |
|---|---|---|---|
| Theme | Token values: color, typography, shape, spacing, elevation, motion, plus optional component themes (button height, text-field shape…) | the brand changes (a new client, dark mode) | brandLightTheme, brandDarkTheme |
| Skin | Structure and behavior: how each component is built, press feedback, surface treatment, and default component proportions | the design language changes (Material → Cupertino → Liquid Glass) | MaterialSkin |
| Component | The public API apps call: text values, icon widgets, callbacks, appearance and tone. It draws nothing. | almost never | CamoButton, CamoTextField |
If a designer changes a value (a color, a radius, a button's height), that is a Theme: a global token, or a component theme. If they change how a thing is built or behaves (a dialog becomes a bottom alert, ripple becomes an opacity fade), that is a Skin.
Glossary
| Term | Meaning |
|---|---|
| Token | A named design value (colors.primary, spacing.l). |
| Role | A semantic token name that says what it's for (onSurface), not what it is (grey900). |
| Renderer | The part of a Skin that draws one component: ButtonRenderer, DialogRenderer. |
| State | The data a renderer needs to draw a component: enabled, pressed, checked, error. |
| Slot | A place where the caller passes a widget: an icon (prefixIcon), a nested component (a dialog's confirm button) or layout content (a card's content). Text is never a slot; it's a value. |
| Component theme | Per-component values (ButtonTheme(height = 48, shape = 12, iconSize = 20)), like Flutter's FilledButtonThemeData. Set in the theme, merged over the skin's defaults. |
| Icon style | The size and color a component sets around its icon widgets, so AppIcon.save() needs no parameters inside a button. |
| Tone | The color family of a component: Default, Error (destructive), Success, Warning, Info. It's independent of the appearance. |
| Surface level | How separated a region is from the background: Surface, Lowest … Highest. |
| Appearance | A component's visual weight, in Camouflage's own words: Solid, Soft, Raised, Outline, Ghost, Link. Skins render it in their dialect (Material's Filled, Apple's .borderedProminent, …). See Design Language. |
| Surface treatment | The "material" of a skin: paper (opaque plus shadow), glass (refracting blur), acrylic (frosted). |
| Interaction feedback | How a skin shows a press: ripple, opacity fade, scale. |
| Provider | CamouflageProvider, which puts a Skin and a Theme into the UI tree for everything below it. |
Doc map
The docs are grouped into folders that map one to one to sidebar categories when they move into the Docusaurus site (srctool/camouflage). Number prefixes (01 - ) set the order; Docusaurus strips them from URLs and titles. kotlin/ and flutter/ mirror the same paths: a platform note lives at the same path as the base note it implements.
| Section | Notes | What you'll know after reading |
|---|---|---|
| Overview | this note | the problem, the vocabulary, where things are |
| 01 - Foundations | Design Language | Camouflage as its own design system: principles, vocabulary (Appearance, Tone, Level), dialect alignment |
| Theme | every token group, component themes, light/dark, the Figma naming contract | |
| Component Inventory | which components each major design system has, and what Camouflage covers | |
| 02 - Architecture | Architecture | how Theme, Skin, Component and modules connect, platforms, where Camouflage sits in an app |
| Skin Contract | what a Skin must provide, how to write a new one | |
| Provider and Scoping | how skins and themes reach components, nesting, switching | |
| 03 - Components | Components — Overview | the component contracts, by group |
| 04 - Skins | Skins | the five v0.1 dialects (ADR-40): Minimal (Camouflage's own), Fluent (Fluent 2), Material, Cupertino (with Liquid Glass), Carbon |
| 05 - Integrations | Figma and AI | how a Figma file becomes a Theme or Skin via the Figma MCP (Later) |
| Figma Conventions | the designer-facing page: how to set up a Figma file for Camouflage | |
| Tooling | tooling that works without Figma: tokens JSON, the camo CLI, camouflage-mcp, a Figma plugin, Studio (Later) | |
| 06 - Project | Roadmap | the waterfall phases, milestones and episodes |
| Decisions | why things are the way they are (ADR log) |
Platform folders: Camouflage — Overview · Camouflage — Overview. They add 02 - Architecture/01 - Project Setup and 07 - Delivery (Publishing, Testing), which have no base counterpart.
How to read the docs
- Top-down once: Overview → Foundations (Design Language, Theme) → Architecture (all three). This gives you the whole model. Read the Component Inventory when planning scope.
- Then per milestone: open Roadmap, pick the next milestone, read its base notes, then build them from the
kotlin/notes at the same paths, then port them with theflutter/notes. - Each note zooms in the same way:
- Why: what the unit is for.
- Shape: responsibilities, dependencies, a diagram.
- API: every class and function, with what it's for.
- Build steps: a checklist ending in Done when. This is also the episode script.
- Edge cases: the decided behavior, and open questions for review.
How platform notes inherit
base/API is pseudocode (Kotlin-like). It fixes names, parameters and meaning.- A platform note keeps every base name and adds only platform details:
Modifier,BuildContext,@Composable,const, and so on. - If a platform can't follow the base contract, the platform note says so in §5 Edge cases and links the decision in Decisions.
Implementation
This folder mirrors base/'s folder structure (same paths, see Camouflage — Overview › Doc map), and turns the platform-neutral design in Camouflage — Overview into Kotlin + Compose Multiplatform code. Every note keeps the base names and meaning, and adds only what Kotlin and Compose need: @Composable, Modifier, CompositionLocal, expect/actual, Gradle.
Toolchain (checked 2026-09-26; re-check at M0)
| Tool | Version | Notes |
|---|---|---|
| Kotlin | 2.4.20 | the language and Kotlin Gradle plugin; the Compose compiler plugin uses the same version |
| Compose Multiplatform | 1.12.1 | based on Jetpack Compose 1.12.1. Android, iOS and desktop are Stable; web (Wasm) is Beta |
| Android Gradle Plugin | 9.4.0 | needs Gradle 9.6 and JDK 17. Library modules use com.android.kotlin.multiplatform.library |
MaterialKolor material-color-utilities | 5.0.1 | the HCT tonal palettes behind CamoColors.fromSeed. Supports every Camouflage target. |
| Roborazzi | latest at M0 | screenshot tests: Android (Robolectric) + desktop, iOS experimental, no web |
| Maven publish (vanniktech) | latest at M0 | Maven Central through the Central Portal |
Repository and modules
The code lives in camouflage-kotlin, included as the kotlin-lib/ submodule of srctool/camouflage.
camouflage-kotlin/
├── build-logic/ # convention plugins (or your published convention plugin)
├── gradle/*.versions.toml # split version catalogs
├── camouflage-core/ # KMP library: theme, skin contract, provider, components, forms
├── camouflage-skin-minimal/ # KMP library: MinimalSkin + baseline themes
├── camouflage-navigation3/ # optional: Navigation 3 scene strategies for Camouflage dialogs and sheets
├── camouflage-bom/ # BOM so apps pin one version for all artifacts
└── sample/
├── shared/ # KMP: sample screens (commonMain) + desktop and web entry points
├── androidApp/ # Android application (AGP 9: separate from the KMP module)
└── iosApp/ # Xcode project, a thin entry point
Package root: com.srctool.camouflage.<module> (e.g. com.srctool.camouflage.core.theme, com.srctool.camouflage.skin.minimal).
Base → Kotlin map
| Section | Base | Kotlin |
|---|---|---|
| Architecture | Architecture | Project Setup (modules, targets, CI) |
| Foundations | Theme | Theme |
| Architecture | Skin Contract | Skin Contract |
| Architecture | Provider and Scoping | Provider and Scoping |
| Components | Components — Overview | Components — Overview |
| Skins | Minimal Skin (v1) | Minimal Skin |
| Skins | Material Skin (Later) | Material Skin |
| Skins | Fluent Skin (v1, ADR-38) | Fluent Skin |
| Skins | Cupertino, Carbon (Later) | platform notes when a skin is picked up |
| Integrations | Figma and AI, Tooling | (Later; tooling is platform-neutral, no Kotlin note) |
| Delivery | (none) | Publishing |
| Delivery | (none) | Testing |
Kotlin-wide conventions for Camouflage
explicitApi()in both libraries: every public declaration sayspublic. That keeps the API surface deliberate, and the ABI dump readable.@Immutable/@Stableon every theme, style, state and skin class, so Compose can skip recomposition. Theme classes aredata classes with onlyvals.modifier: Modifier = Modifieris the first optional parameter of every public composable (Compose API guidelines), a platform extra on top of the base contract.- Icon and content parameters are
@Composable () -> Unitlambdas. That's how Compose passes widgets (base ADR-12). - No Material dependency in v1. Core and the Minimal skin use only
foundation+ui(the Minimal skin draws its own fade feedback). A Later Material skin addsmaterial-ripplefor its ripple node, and nevermaterial3. - Common code only.
expect/actualis limited to the platform table in Architecture §2.4. - No DI, no networking, no ViewModels in the libraries. Those belong to apps. (Your Koin/Ktor/ViewModel conventions apply to the
sampleapp, if it grows.)
Web (planned)
This folder holds the design notes for Camouflage for web: the third platform next to Kotlin and Flutter, built as Web Components in TypeScript (ADR-34, ADR-43, ADR-46). It follows the same layout as kotlin/ and flutter/: each note has implements: pointing to its base note, the base note says what and why, and the web note says how on the web.
W1 (foundations) is built in srctool/camouflage-web: the full theme model with fromSeed and validateTheme checked against Dart, the provider environment, the skin contract and behavior layer, the scenario-driven screenshot and conformance harness, the contract, manifest and typings checks, and the two skin packages. Type sizes are rem. See each note's "What W1 settled".
The spike is built in srctool/camouflage-web (provider, button and dialog in Minimal and Cupertino, server rendering and hydration, Storybook under /web/, the manifest check). ADR-46 is accepted with amendments, and ADR-47 and ADR-48 record the server rendering and no-provider decisions. Next.js App Router passes. Still open from W0: the spike page in a Tauri window on Windows and Linux (macOS matches Chromium and WebKit), the first task of W1.
1. Goal and scope
Goal: a web version of Camouflage that works from any web framework (React, Vue, Svelte, Angular, plain HTML) and from Tauri webviews, with server-side rendering, and the same vocabulary as Kotlin and Dart.
Scope: parity with v0.2.0 of the Kotlin and Dart libraries. That means:
- the theme model and the provider (base Theme, Provider and Scoping);
- the skin contract, and the five skins: Minimal, Material, Cupertino, Fluent and Carbon;
- the full component set of v0.1 plus the M16 desktop foundations (menu submenus, split pane, scrollbar, Carbon density);
- charts, last.
Later desktop tools (srctool/camouflage#72 to #76) follow the Kotlin and Dart work, not the other way around.
Parity means: the same names, parameters, states and accessibility guarantees. It does not mean pixel parity: materials follow ADR-42 (the best surface each platform allows, with a fallback chain), and webview differences are documented per skin.
2. Decisions made
| Question | Decision | Why |
|---|---|---|
| Language | TypeScript, strict | typed contract, and the skin model is easier to keep honest with types than with JS |
| Component library | Lit 3 (custom elements) | small runtime; skins are plain TypeScript modules, not tied to a compiler; context protocol; server rendering |
| Skin model | B: skins are render functions in separate packages (see Skin Contract) | skins change structure (stacked alerts, segmented tabs), so CSS alone can't do it; per-skin packages keep bundles small |
| Server rendering | A goal, proven by the spike | needs shadow DOM components and pure render functions, which the skin model already requires |
| Theme | CSS custom properties, --camo-* (ADR-43, Theme) | SSR-safe from the first byte, crosses shadow roots |
| Tauri and Rust | Web Components run in the webview; no Rust port | ADR-43 |
Stencil was considered. It generates React, Vue and Angular wrappers and has a hydrate build, but it ties every skin package to its compiler. Generated wrappers can be added later from the Custom Elements Manifest if React ergonomics need them.
3. Toolchain (to confirm at W0)
| Tool | Choice | Notes |
|---|---|---|
| Language | TypeScript 5.x, strict | exact version pinned at W0 |
| Components | Lit 3, @lit/context for the skin and theme | server rendering through @lit-labs/ssr (a labs package: re-check its status at W0) |
| Workspace | pnpm workspaces | see Project Setup |
| Build | Vite library mode (or tsup) | ESM only, per-package entry points |
| Tests | Vitest browser mode + Playwright | behavior tests and screenshots; axe for accessibility |
| Docs and previews | Storybook 10 for web components, hosted inside the usage site at /web/ (decided, built in W0) | same scenarios as the Kotlin and Dart goldens; see Project Setup §3.6 |
| Manifest | Custom Elements Manifest analyzer | feeds docs, typings and later camouflage-contract.json |
3b. Browser baseline (decided at W0)
Baseline widely available at the release date, for everything core uses. Today that is Chrome and Edge 111, Firefox 123, Safari 16.4 (declarative shadow DOM is the limit), and it rises to Chrome 116, Firefox 125 and Safari 17 when the first popover component ships (W4). A feature that is only newly available or not Baseline is progressive with a fallback: anchor positioning (core positions with a script), backdrop-filter and SVG-filter glass (the ADR-42 capability chain), prefers-reduced-transparency (absent means false), scrollbar-width (the scrollbar skin draws its own). WebView2 is evergreen Chromium; WKWebView follows the macOS version (Safari 16.4 is macOS 13.3, Safari 17 is macOS 14); WebKitGTK follows the distribution and is the open row. The feature-by-engine table, the probe and how to run the Tauri window are in docs/browser-baseline.md in the web repository. The spike scenario gives the same result in Chromium, WebKit and the Tauri macOS window; Firefox runs in CI.
4. Packages
One npm scope, @srctool (the organization exists), with the package names @srctool/camouflage-*:
camouflage-web/
├── packages/
│ ├── core/ # theme, provider, skin contract, behavior, every component (no look)
│ ├── skin-minimal/ # the Minimal skin's renderers and styles
│ ├── skin-material/ # Material 3
│ ├── skin-cupertino/ # Apple, Classic and Liquid Glass
│ ├── skin-fluent/ # Fluent 2
│ ├── skin-carbon/ # IBM Carbon
│ └── charts/ # the chart components and presets
├── apps/
│ ├── storybook/ # component galleries and screenshots
│ ├── sample/ # the sample app (also built as a Tauri app)
│ └── ssr-sample/ # Next.js (and plain Node) server rendering sample
└── tools/ # contract generation, release scripts
5. Plan
W0: spike (first, time-boxed). Prove the skin model and server rendering before anything else is built:
camo-provider(theme variables, skin by attribute and property, context).camo-buttonandcamo-dialogin Minimal and Cupertino, light and dark.- Server-render them with
@lit-labs/ssr, then hydrate in the browser, in a plain Node page and in a Next.js page. - Run the same page in a Tauri window.
If the dialog with stacked buttons works under both skins and renders on the server, the model holds. The fallback if Lit's server rendering falls short is in SSR and Hydration.
After the spike, the milestones follow the Kotlin order so the contract and the goldens line up:
| Web milestone | Mirrors | Content |
|---|---|---|
| W1 Foundations | M1, M2 | theme, validateTheme, provider, skin contract, test and screenshot harness, Minimal skin shell |
| W2 Primitives and actions | M3 | text, icon, surface, divider, button, icon button |
| W3 Inputs | M5 | text field, checkbox, switch, radio, segmented control, slider, search field, form, pickers, stepper |
| W4 Structure and overlays | M6 | card, lists, skeleton, dialog, bottom sheet, menu, tooltip |
| W5 Feedback, data display, navigation | M7, M8 | progress, snackbar, banner, chips, badge, avatar, tabs, navigation bar, rail, drawer, FAB |
| W6 Components that arrived later | M9, M10 | popover, side sheet, toolbar, button group, split button, carousel, file uploader and the rest |
| W7 Charts | M11 | the chart frame, line, bar and pie charts, sparkline |
| W8 Skins | M12 to M14 | Material, Cupertino (with Liquid Glass), Fluent, Carbon |
| W9 Desktop foundations | M16 | menu submenus, split pane, scrollbar, Carbon density |
| W10 Release | M15 | the test matrix, accessibility passes, publishing 0.2.0 |
Tracking: each milestone is a GitHub milestone in srctool/camouflage-web with a parent card and task cards, on the Camouflage board (parent cards: W0 #8, W1 #15, W2 #20, W3 #27, W4 #35, W5 #40, W6 #46, W7 #51, W8 #57, W9 #63, W10 #69). Only W0 is in Todo; the rest are in Backlog until they start.
Minimal ships first so every component has one complete skin early. A second, structurally different skin (Cupertino) is built during W1 to W2, not at the end, so the skin contract is tested against real differences from the start.
6. Risks
| Risk | Mitigation |
|---|---|
| Three implementations drift apart | camouflage-contract.json generated from the notes, one scenario list shared by the three goldens suites, generated docs |
| Server rendering with Lit is a labs feature | the spike tests it first; the render functions are pure, so a thin renderer of our own is a fallback |
Accessibility across shadow roots (aria-labelledby cannot cross them) | a shared behavior layer, ElementInternals for form fields, axe in the test suite |
| Bundle size | per-skin packages, sideEffects flags, a size budget per component checked in CI |
| Webview differences (WebKitGTK is the oldest) | a browser baseline chosen at W0; the capability chain of ADR-42 for materials |
7. Decisions still open
Every decision the W0 list named is decided, or moved to a milestone.
| Decision | State |
|---|---|
| Server rendering: Lit's package or our own renderer | Decided, Lit (ADR-47) |
| A component with no provider | Decided, opt-in fallback, else unstyled and a warning (ADR-48) |
Decorators or static properties | Decided, static properties with declare (Project Setup §2) |
| How the Storybook build reaches the usage site | Decided, the pinned submodule build, option A (Project Setup §3.6) |
| Default slot as text, one or two overlay option types | Decided (Components Overview §6) |
| The browser baseline, including the Tauri webviews | Decided: Baseline widely available at the release date for everything core uses; newer features are progressive with a fallback (§3b). Open: WebKitGTK and WebView2 were not run (no Linux or Windows machine), first task of W1 |
| Next.js App Router | Proven on Next 16 (ADR-47); static generation and next dev still untried |
| Generated React, Vue and Angular wrappers | W10, from the manifest, if native custom element support is not enough |
8. Doc map
| Note | Base note |
|---|---|
| Theme | Theme |
| Project Setup | Project Setup (Kotlin and Flutter) |
| Skin Contract | Skin Contract |
| Provider and Scoping | Provider and Scoping |
| SSR and Hydration | (web only) |
| Components — Overview | Components Overview (the API conventions: how a contract parameter becomes an attribute, property, slot or event) |