Carbon Skin
Concept
Documented first (ADR-22); ADR-40 puts it in v0.1 as the last of the five skins. It is built whole in one pass after Minimal, Fluent, Material and Cupertino (the M12 ruling: CamoSkin has no defaults, so a partial skin can't compile).
1. Why
CarbonSkin renders Camouflage in IBM Carbon's dialect: square corners, flat layered surfaces, a strong grid, productive density, and a bold blue interactive color. It suits enterprise, data-heavy and desktop tools. It stresses the contract in two ways:
- text fields with a bottom border only (a different anatomy);
- layers instead of elevation, where depth is a different gray per nesting level.
2. Shape
Surface treatment: Layered. Surfaces use layer tokens (layer-01 … layer-03), which map to Camouflage's surface levels. There are no shadows, except for overlays (dialogs and menus get Carbon's single overlay shadow).
Interaction feedback: CarbonStates. Background swaps to …-hover / …-active tokens. Focus is a 2 px inset focus border (focus color), so it never changes the layout.
3. API
fun carbonSkin(): CamoSkin
fun carbonTheme(family: CarbonThemeFamily = White, fontFamily: FontFamily? = null): CamoTheme // White | G10 (light) · G90 | G100 (dark)
Starter theme:
- Carbon's four themes map to roles:
background→surface,layer-01..03→surfaceContainerLow..High,text-primary/secondary→onSurface/onSurfaceVariant,border-strong/subtle→outline/outlineVariant,interactive/button-primary→primary(blue 60),support-error/success/warning/info→ the status families. - Typography: IBM Plex Sans for the authentic look, added by the app (skins never bundle fonts):
carbonTheme(fontFamily = IbmPlexSans), falling back to the platform font, with Carbon's type sets mapped to the 15 roles (heading-07 54 → displayLarge … body-compact-01 14 → bodyMedium, label-01 12 → labelMedium, helper-text-01 12 → bodySmall). - Shapes: all 0, except
fullfor toggles and tags. - Values come from Carbon's published tokens at implementation time.
3.1 Dialect alignment
| Appearance | Carbon rendering |
|---|---|
Solid | Primary button (blue 60 fill) |
Soft | Secondary button (gray 80 fill, white text) |
Raised | → Soft |
Outline | Tertiary button (blue border and text) |
Ghost | Ghost button |
Link | → Link component style (blue, underline on hover) |
| Tone | Carbon |
|---|---|
| Error | Danger button, support-error |
| Success / Warning / Info | support-success / support-warning / support-info |
3.2 Component mapping
| Component | Carbon equivalent | Rendering |
|---|---|---|
| CamoButton / IconButton | Button (+ icon-only) | 48 tall (productive 40), square, text start-aligned with the icon at the end |
| CamoFab | – | a square primary icon button (guidance: use a toolbar) |
| CamoTextField | Text input | field-01 fill + bottom border only, label above, helper text below, 40 tall |
| CamoCheckbox / Radio | Checkbox / Radio button | 16 square box / circle |
| CamoSwitch | Toggle | 48 × 24, green (support-success) when on, with an "On/Off" label option |
| CamoSegmentedControl | Content switcher | square segments, selected = inverse fill |
| CamoSlider | Slider | 2 px track, 14 thumb, a number input beside it (optional) |
| CamoDatePicker | Date picker | style Calendar, square cells |
| CamoTimePicker | Time picker | style Fields with an AM/PM select |
| CamoStepper | Number input | layout Split |
| CamoSearchField | Search | field fill, magnifier, square |
| CamoSelect | Dropdown / Select | field look + a square menu |
| CamoCard | Tile | layer fill, square, optional clickable/selectable |
| CamoAccordion | Accordion | chevron at the end, bottom borders |
| CamoListItem | Structured list / Contained list | rows with bottom borders |
| CamoChip | Tag | pill tags (the one rounded element), in type colors |
| CamoBadge | – (tag) | a small pill with a count |
| CamoAvatar | – | AvatarTheme.shape default Square (circle allowed), gray initials |
| CamoProgress | Progress bar / Loading | 2 px bar; the circle becomes the Carbon loading spinner |
| CamoSnackbar | Toast notification | a square toast with a colored left border; showToneIcon true, showDismiss true |
| CamoBanner | Inline notification | a colored left border (the accentBorder option) + icon + actions |
| CamoDialog | Modal | square, layer fill, title 20, actionsLayout FullWidthRow, showCloseButton true (shown when dismissible) |
| CamoBottomSheet | – | → a side panel or modal from the bottom, square, showHandle default false |
| CamoMenu | Menu / Overflow menu | square, 40 items, overlay shadow |
| CamoTooltip | Tooltip / Toggletip | inverse, square with a caret |
| CamoTopBar | UI shell header | 48 tall, gray 100 (dark) header in every theme |
| CamoTabs | Tabs | Solid → contained tabs, Ghost → line tabs |
| CamoNavigationBar | – | a bottom bar in Carbon style (mobile) |
| CamoNavigationRail / Drawer | UI shell left panel (rail / expanded) | 48 rail, 256 panel, indicator Line (a blue start-edge line) |
| CamoPagedList | Structured list + Loading | inline loading row at the end |
| CamoSkeleton | Skeleton states | pulse, skeleton-background / skeleton-element |
| CamoDivider | (borders) | 1 px border-subtle |
| CamoPopover | Popover | square corners, a caret, layer-01, 1 px border |
| CamoSideSheet | Side panel | a 320 panel on the end edge, layer-01, a 1 px border; modal over a scrim |
| CamoToolbar | – | a 48 bar with square ghost buttons (guidance: use the global header for navigation) |
| CamoButtonGroup | Button set | square, connected with 1 px dividers; the selected button is the inverse fill |
| CamoSplitButton | Combo button | a square primary button with a 48 chevron part and a divider |
| CamoDataTable | Data table | a layer-01 header, rows 48 (zebra optional), a bottom border per row, batch actions bar when rows are selected |
| CamoTree | Tree view | rows 32, a caret, a selected row with a 3 px left bar |
| CamoCarousel | Carousel | a content switcher style strip: square items, previous and next icon buttons |
| CamoImage | Image | square, an layer-02 placeholder |
| CamoRating | Rating | stars 20 in icon-primary |
| CamoFileUploader | File uploader | a layer-01 drop container with a dashed border, file rows with an inline status and a remove icon |
| CamoPagination | Pagination | a bar with an items-per-page area, a range text and previous/next icon buttons |
| CamoBreadcrumb | Breadcrumb | bodyCompact01, slash separators, an overflow menu, the current item bold |
| CamoProgressSteps | Progress indicator | 16 px circles on a line, a check for complete, a current ring, vertical option |
3.3 Carbon under ADR-42 (materials rule)
Carbon has no materials: no blur, no glass, no shader. Layered is opaque everywhere, so the skin reads no CamoCapabilities (like Material) and needs no fallback chain. The only things that vary by environment are the input kind (a touch device keeps the 48 targets; a pointer may use the 40 productive heights through CamoDensity) and the platform font.
3.4 Chart preset
Charts reach skins through the preset registered for skin.name == "carbon" (Chart Frame); like the others it ships in the charts package. Proposed values, from Carbon Charts' defaults (square, flat, dashed grid):
ChartStyle field | Carbon | Why |
|---|---|---|
lineWidth | 1.5 | Carbon Charts' thin line |
markerSize | 6 | a point of radius 3 |
areaOpacity | 0.3 | a flat fill under the line |
barRadius | 0 | square, like the whole system |
barGap | 1 | bars nearly touch |
gridDashed | true | Carbon draws dashed grid lines |
sliceGap | 1 | a hairline between slices |
donutThickness | 0.35 | a ring thinner than Cupertino's |
The palette stays the theme's (Carbon's categorical palette is a brand choice, not a preset); the tooltip is a square layer-02 box with a 1 px border.
3.5 Density (M16, srctool/camouflage#70)
Carbon draws every control at 48 today (the "large" size). Carbon's own size tokens are xs 24, sm 32, md 40 and lg 48, and desktop apps live at 32 and 40. Without a density option an app overrides every component theme, which is what Fluent's density already avoids.
| Control | xs 24 | sm 32 | md 40 | lg 48 (today) |
|---|---|---|---|---|
| Button, icon button | 24 (bodyCompact01, 12) | 32 | 40 | 48 |
| Text field, search, select, number input | 24 | 32 | 40 | 48 (the field stays 40 today; see the callout) |
| Menu item, list row, tree row | 24 | 32 | 40 | 48 |
| Data table row | 24 | 32 | 40 | 48 |
| Tab, toolbar action | 24 | 32 | 40 | 48 |
Paddings, icon sizes (16 at xs and sm, 20 at md, 24 at lg) and the type size follow the size: Carbon's body-compact-01 (14) at sm and above, 12 at xs. Heights are minimums, so 200% text still grows a control (the rule every component follows).
How the skin follows the input. carbonTheme(density = null) follows CamoEnvironment.input (ADR-41), the same rule as fluentTheme(density): a pointer gets md, fingers get lg. An explicit value wins. The 48 touch target is never reduced: a 24 control with touch input still has a 48 hit area (minimumTouchTarget on Kotlin, CamoTouchTarget on Flutter), so xs costs nothing in accessibility.
carbonTheme(density: CarbonDensity?) takes Xs 24, Sm 32, Md 40 or Lg 48 and carries it as a CarbonDensityTokens token set (one theme-level value, the first proposal). null follows the input: a pointer gets Md, fingers get Lg; a theme without the tokens keeps 48. Settled in the build:
- Icons stay 16 at every size, not 16 / 16 / 20 / 24: Carbon's spec keeps 16 px icons, and a 24 icon cannot fit an
Xscontrol.Xsdraws 12 text. - Text fields are 48 at
Lg(they were 40): the field now matches the 48 touch target, and 40 isMd. - Controls that follow it: button, icon button, text and search field (so the select), stepper, segmented control, menu item, list row, tree row, data table row and header, tab, button group, split button and toolbar action. Not density: the top bar (the 48 UI shell header), the snackbar, the FAB, tags, pagination and the progress circle.
- The data table has no
densityparameter of its own on either platform, so the second open question did not arise: its rows read the theme. - The default changed (a pointer now draws 40, touch fields and menus 48), as proposed; the CHANGELOGs say so.
4. Build steps
- The
Layeredsurface,CarbonStatesfeedback, and the inset focus border. carbonThemefor the four families, with afontFamilyparameter (the sample app adds IBM Plex Sans).- The renderers. Bottom-border text fields and full-width modal button rows are the structural tests. The M9 to M11 ones are included, and the
"carbon"chart preset (§3.4). - The screenshot matrix (White and G100 at least; G10 and G90 in the theme test), plus a manual comparison with Carbon's own components.
Done when
- All 52 renderers in the White and G100 themes, the M9 to M11 components (popover, side sheet, data table, charts …) included. The layer nesting (a card inside a card) steps gray correctly.
5. Edge cases
| Case | Decided behavior |
|---|---|
| Layer nesting | Carbon's rule: a component on layer-01 uses layer-02 for its own fill. Camouflage's SurfaceLevel handles this, and nested surfaces step up one level. |
Square corners vs shapes tokens | The Carbon theme sets all shape roles to 0. A brand can still round them, and it's no longer strict Carbon. |
| The dark header in light themes | A Carbon convention: TopBarTheme.colors defaults to gray 100 in every family. |
A material requested (a Surface marked blur) | Layered ignores it: every level is an opaque layer token. |
| Contract gaps found | Record them as ADRs and add them to core (e.g. a content switcher with an inverse selected fill). |
| Touch devices | Carbon is desktop-first. The 48 touch targets still apply (the component guarantees them). |
- Built whole on both platforms (the M12 ruling), from a copy of Minimal:
camouflage-skin-carbon/camouflage_skin_carbon,Layered(opaque layer tokens, no hairline, the one overlay shadow fromLevel3),CarbonStates(hover 8% and pressed 20% overlays; the focus is a 2 pxprimaryborder inside the bounds with a 1 pxsurfaceline inside it, so a filled button still shows it),carbonTheme(family, accent, fontFamily)for White, G10, G90 and G100, the 52 renderers, and the"carbon"chart preset (§3.4). - Brand:
carbonThemetakes anaccentlike the other skins (only theprimaryfamily changes), because the sample's brand switcher and the brand contrast test need it. - Colors are Carbon's published tokens, with three deviations for contrast: the dark families'
primaryis blue 50 with gray 100 text (Carbon's dark button is blue 60 with white text; blue 60 on gray 100 is 3.0, below AA for the link role), the light success is green 60 and the toggle's on color issuccess. White, G10 and G100 pass every pair; G90 fails only on text over its two highest layers (gray 60), which is how Carbon's own tokens fall (the theme test pins the list). - Anatomy as built: buttons 48 tall, square, label at the start and the icon 32 away at the end; secondary is gray 80, tertiary a blue outline; icon buttons 48; text fields 40 on the
fieldfill with a bottom border only (2 px inset border when focused or in error); 40 search; a 16 square checkbox; the 48 × 24 toggle (green when on); content-switcher segments (selected = inverse fill); the number input is the Split stepper; tags are pills (the one rounded element), avatars square; toasts and inline notifications carry a colored left border and an icon; the dialog is square with a full-width action row and a close button; line tabs by default (Solid is the contained tabs); a 48 gray 100 header in every family; a 48 icon rail and a 256 side panel with a start line; tiles with no border; 48 table rows; rows with bottom borders. - Not built: an "On/Off" text beside the toggle (the app's), the batch-actions bar of the data table, a 3 px left bar on the selected tree row, the contained tab's dividers, the productive 40 button height, and Carbon's own loading spinner (the circle is the shared one, with butt caps).
- Defaults:
carbonLightis White andcarbonDarkis G100; the sample and the example switch between them with the mode.
Density (§3.5) is the first M16 item, raised by Graft (#70). It adds no renderer and changes no contract: it is a token set on the theme, read by the existing renderers.
Implementation
Read the base note first: Carbon Skin. The module follows camouflage-skin-minimal and camouflage-skin-material (CarbonSkin.kt, CarbonTheme.kt, Layered.kt, CarbonStates.kt, renderer/Carbon*.kt). This note is the platform plan.
1. Why
:camouflage-skin-carbon implements every renderer in IBM Carbon's dialect using only Compose foundation plus camouflage-core's public API. It is the skin with the plainest surface (no shadows, no materials) and the most structural differences in inputs: a text field with a bottom border only, a button whose label starts at the left and whose icon sits at the end, square everything.
2. Shape
3. API
public val CarbonSkin: CamoSkin = carbonSkin()
public fun carbonSkin(): CamoSkin
public enum class CarbonThemeFamily { White, G10, G90, G100 }
public fun carbonTheme(family: CarbonThemeFamily = White, fontFamily: FontFamily? = null): CamoTheme
public val carbonLight: CamoTheme // White
public val carbonDark: CamoTheme // G100
Layered: opaque fills only. A level maps to a layer token; a surface nested in a surface of the same level steps up one (SurfaceLevel). Only overlays (dialog, menu, popover, side sheet when modal) get the single overlay shadow.CarbonStates: a hover or pressed state swaps the fill to the…-hover/…-activetoken (anIndicationNodeFactorydrawing the token over the content); focus is a 2 px inset border infocus, drawn inside the bounds so layout never moves; disabled uses…-disabledtokens. No ripple, no opacity change.- Theme:
carbonThememaps the four families' published tokens to roles (base note §3), the shapes are all 0 exceptfull, the motion is Carbon's productive/expressive curves, and the type set is mapped to the 15 roles. The font is not bundled (ADR-33): the sample adds IBM Plex Sans throughfontFamily. - Pinned literals: like Material and Cupertino, a snapshot test pins the token values (Carbon's own contrast pairs are AA, so the theme test asserts every foreground/background pair passes).
- Chart preset:
"carbon"incamouflage-charts(values in the base note §3.4).
4. Build steps
M14 is built in one pass (the M12 ruling), then reviewed as a whole; the task cards close together.
- Copy Minimal's module as the starting point, then
Layered,CarbonStates, the inset focus border. carbonThemefor the four families, with the pinned-literal and contrast tests.- The renderers with Carbon anatomy, structure first: text field (bottom border, label above), buttons (48, start-aligned label, icon at the end), dialog (square, full-width action row), data table, UI-shell header and side panel, toggle, content switcher, tabs.
- The M9 to M11 renderers and the
"carbon"chart preset. - The sample switcher entry (Carbon with a family choice on the theme page), goldens (White, G100, brand),
assertRendererAppliesBehavioron every clickable renderer, the no-literals test.
Done when
-
:camouflage-skin-carbonhas no Material dependency; it is at layer 1 (checkModuleLayers) and in the BOM. - All 52 renderers pass the behavior and no-literals tests.
- Goldens are recorded for White and G100 (light and dark); local macOS renders are replaced by CI's Linux ones.
- The sample switches Minimal / Fluent / Material / Cupertino / Carbon live.
-
CamoChartshas the"carbon"preset.
5. Edge cases
| Case | Decided behavior |
|---|---|
| Nested surface | Steps up one layer token (layer-01 to layer-02 to layer-03); at layer-03 it stays. |
| A brand that rounds the shapes | Allowed, no longer strict Carbon. |
| The header in a light family | Gray 100 by default (TopBarTheme.colors). |
| Focus on a field with a bottom border | The 2 px inset border goes around the whole field, not only the bottom edge. |
| Carbon on mobile | Allowed. The 48 targets hold; Carbon's 40 productive height applies only when the density is Compact. |
- Module
camouflage-skin-carbon:Layered,CarbonStates,carbonTheme(family, accent, fontFamily)(the enum isCarbonThemeFamily), the 52 renderers;CarbonSkinis the skin andcarbonLight/carbonDarkare White and G100. The sample switcher has Carbon (White by day, G100 at night). Top-level theme values initialize in file order: the color constants come beforecarbonLight. - See the base note's callout for the shared deviations (contrast, the G90 exception, what is not built). Both platforms ship the chart preset in §3.4 as
"carbon".
- Theme:
carbonTheme(family, accent, fontFamily, density: CarbonDensity? = null). The enum isCarbonDensity { Xs, Sm, Md, Lg }. The value is stored in aCarbonTokens(density)token set (theme.tokens<CarbonTokens>()), andnulladapts throughtheme.adapt { env -> ... }(as Fluent does):Pointer→Md,Touch→Lg. - Renderers: each renderer's
defaults(theme)readstheme.tokens<CarbonTokens>()?.density ?: Lgthrough one internalCarbonSizestable (height, padding, icon size, text style), replacing the48.dpand40.dpliterals inCarbonActions,CarbonInputs,CarbonLists,CarbonGroups,CarbonNavigationandCarbonNavigationChrome. - Touch target: unchanged;
minimumTouchTarget()keeps 48 × 48 around a 24 control. - Tests: a size table test per density (button, field, row heights), the
nulladaptation forPointerandTouch, an explicit value winning, the 48 target holding atXswith touch, and goldens per density in White and G100. - Done when: a Carbon screen at
Xshas 24 buttons, fields and rows with no component-theme override, on Kotlin.