Skip to main content

Camouflage — Overview

Concept​

One sentence

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 (ElevatedButton vs CupertinoButton). Switching means changing call sites.
  • Jetpack Compose lets you build a custom design system on compose.foundation with your own CompositionLocals. But material3 components read only MaterialTheme, 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​

ConceptOwnsChanges when…Example
ThemeToken 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
SkinStructure and behavior: how each component is built, press feedback, surface treatment, and default component proportionsthe design language changes (Material → Cupertino → Liquid Glass)MaterialSkin
ComponentThe public API apps call: text values, icon widgets, callbacks, appearance and tone. It draws nothing.almost neverCamoButton, CamoTextField
Rule of thumb

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​

TermMeaning
TokenA named design value (colors.primary, spacing.l).
RoleA semantic token name that says what it's for (onSurface), not what it is (grey900).
RendererThe part of a Skin that draws one component: ButtonRenderer, DialogRenderer.
StateThe data a renderer needs to draw a component: enabled, pressed, checked, error.
SlotA 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 themePer-component values (ButtonTheme(height = 48, shape = 12, iconSize = 20)), like Flutter's FilledButtonThemeData. Set in the theme, merged over the skin's defaults.
Icon styleThe size and color a component sets around its icon widgets, so AppIcon.save() needs no parameters inside a button.
ToneThe color family of a component: Default, Error (destructive), Success, Warning, Info. It's independent of the appearance.
Surface levelHow separated a region is from the background: Surface, Lowest … Highest.
AppearanceA 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 treatmentThe "material" of a skin: paper (opaque plus shadow), glass (refracting blur), acrylic (frosted).
Interaction feedbackHow a skin shows a press: ripple, opacity fade, scale.
ProviderCamouflageProvider, 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.

SectionNotesWhat you'll know after reading
Overviewthis notethe problem, the vocabulary, where things are
01 - FoundationsDesign LanguageCamouflage as its own design system: principles, vocabulary (Appearance, Tone, Level), dialect alignment
Themeevery token group, component themes, light/dark, the Figma naming contract
Component Inventorywhich components each major design system has, and what Camouflage covers
02 - ArchitectureArchitecturehow Theme, Skin, Component and modules connect, platforms, where Camouflage sits in an app
Skin Contractwhat a Skin must provide, how to write a new one
Provider and Scopinghow skins and themes reach components, nesting, switching
03 - ComponentsComponents — Overviewthe component contracts, by group
04 - SkinsSkinsthe five v0.1 dialects (ADR-40): Minimal (Camouflage's own), Fluent (Fluent 2), Material, Cupertino (with Liquid Glass), Carbon
05 - IntegrationsFigma and AIhow a Figma file becomes a Theme or Skin via the Figma MCP (Later)
Figma Conventionsthe designer-facing page: how to set up a Figma file for Camouflage
Toolingtooling that works without Figma: tokens JSON, the camo CLI, camouflage-mcp, a Figma plugin, Studio (Later)
06 - ProjectRoadmapthe waterfall phases, milestones and episodes
Decisionswhy 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​

  1. Top-down once: Overview → Foundations (Design Language, Theme) → Architecture (all three). This gives you the whole model. Read the Component Inventory when planning scope.
  2. 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 the flutter/ notes.
  3. Each note zooms in the same way:
    1. Why: what the unit is for.
    2. Shape: responsibilities, dependencies, a diagram.
    3. API: every class and function, with what it's for.
    4. Build steps: a checklist ending in Done when. This is also the episode script.
    5. 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)​

ToolVersionNotes
Kotlin2.4.20the language and Kotlin Gradle plugin; the Compose compiler plugin uses the same version
Compose Multiplatform1.12.1based on Jetpack Compose 1.12.1. Android, iOS and desktop are Stable; web (Wasm) is Beta
Android Gradle Plugin9.4.0needs Gradle 9.6 and JDK 17. Library modules use com.android.kotlin.multiplatform.library
MaterialKolor material-color-utilities5.0.1the HCT tonal palettes behind CamoColors.fromSeed. Supports every Camouflage target.
Roborazzilatest at M0screenshot tests: Android (Robolectric) + desktop, iOS experimental, no web
Maven publish (vanniktech)latest at M0Maven 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​

SectionBaseKotlin
ArchitectureArchitectureProject Setup (modules, targets, CI)
FoundationsThemeTheme
ArchitectureSkin ContractSkin Contract
ArchitectureProvider and ScopingProvider and Scoping
ComponentsComponents — OverviewComponents — Overview
SkinsMinimal Skin (v1)Minimal Skin
SkinsMaterial Skin (Later)Material Skin
SkinsFluent Skin (v1, ADR-38)Fluent Skin
SkinsCupertino, Carbon (Later)platform notes when a skin is picked up
IntegrationsFigma and AI, Tooling(Later; tooling is platform-neutral, no Kotlin note)
Delivery(none)Publishing
Delivery(none)Testing

Kotlin-wide conventions for Camouflage​

  1. explicitApi() in both libraries: every public declaration says public. That keeps the API surface deliberate, and the ABI dump readable.
  2. @Immutable / @Stable on every theme, style, state and skin class, so Compose can skip recomposition. Theme classes are data classes with only vals.
  3. modifier: Modifier = Modifier is the first optional parameter of every public composable (Compose API guidelines), a platform extra on top of the base contract.
  4. Icon and content parameters are @Composable () -> Unit lambdas. That's how Compose passes widgets (base ADR-12).
  5. 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 adds material-ripple for its ripple node, and never material3.
  6. Common code only. expect/actual is limited to the platform table in Architecture §2.4.
  7. No DI, no networking, no ViewModels in the libraries. Those belong to apps. (Your Koin/Ktor/ViewModel conventions apply to the sample app, 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.

Status: W1 foundations built, W0 checks still open

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​

QuestionDecisionWhy
LanguageTypeScript, stricttyped contract, and the skin model is easier to keep honest with types than with JS
Component libraryLit 3 (custom elements)small runtime; skins are plain TypeScript modules, not tied to a compiler; context protocol; server rendering
Skin modelB: 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 renderingA goal, proven by the spikeneeds shadow DOM components and pure render functions, which the skin model already requires
ThemeCSS custom properties, --camo-* (ADR-43, Theme)SSR-safe from the first byte, crosses shadow roots
Tauri and RustWeb Components run in the webview; no Rust portADR-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)​

ToolChoiceNotes
LanguageTypeScript 5.x, strictexact version pinned at W0
ComponentsLit 3, @lit/context for the skin and themeserver rendering through @lit-labs/ssr (a labs package: re-check its status at W0)
Workspacepnpm workspacessee Project Setup
BuildVite library mode (or tsup)ESM only, per-package entry points
TestsVitest browser mode + Playwrightbehavior tests and screenshots; axe for accessibility
Docs and previewsStorybook 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
ManifestCustom Elements Manifest analyzerfeeds 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:

  1. camo-provider (theme variables, skin by attribute and property, context).
  2. camo-button and camo-dialog in Minimal and Cupertino, light and dark.
  3. Server-render them with @lit-labs/ssr, then hydrate in the browser, in a plain Node page and in a Next.js page.
  4. 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 milestoneMirrorsContent
W1 FoundationsM1, M2theme, validateTheme, provider, skin contract, test and screenshot harness, Minimal skin shell
W2 Primitives and actionsM3text, icon, surface, divider, button, icon button
W3 InputsM5text field, checkbox, switch, radio, segmented control, slider, search field, form, pickers, stepper
W4 Structure and overlaysM6card, lists, skeleton, dialog, bottom sheet, menu, tooltip
W5 Feedback, data display, navigationM7, M8progress, snackbar, banner, chips, badge, avatar, tabs, navigation bar, rail, drawer, FAB
W6 Components that arrived laterM9, M10popover, side sheet, toolbar, button group, split button, carousel, file uploader and the rest
W7 ChartsM11the chart frame, line, bar and pie charts, sparkline
W8 SkinsM12 to M14Material, Cupertino (with Liquid Glass), Fluent, Carbon
W9 Desktop foundationsM16menu submenus, split pane, scrollbar, Carbon density
W10 ReleaseM15the 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​

RiskMitigation
Three implementations drift apartcamouflage-contract.json generated from the notes, one scenario list shared by the three goldens suites, generated docs
Server rendering with Lit is a labs featurethe 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 sizeper-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.

DecisionState
Server rendering: Lit's package or our own rendererDecided, Lit (ADR-47)
A component with no providerDecided, opt-in fallback, else unstyled and a warning (ADR-48)
Decorators or static propertiesDecided, static properties with declare (Project Setup §2)
How the Storybook build reaches the usage siteDecided, the pinned submodule build, option A (Project Setup §3.6)
Default slot as text, one or two overlay option typesDecided (Components Overview §6)
The browser baseline, including the Tauri webviewsDecided: 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 RouterProven on Next 16 (ADR-47); static generation and next dev still untried
Generated React, Vue and Angular wrappersW10, from the manifest, if native custom element support is not enough

8. Doc map​

NoteBase note
ThemeTheme
Project SetupProject Setup (Kotlin and Flutter)
Skin ContractSkin Contract
Provider and ScopingProvider and Scoping
SSR and Hydration(web only)
Components — OverviewComponents Overview (the API conventions: how a contract parameter becomes an attribute, property, slot or event)