agentleFS
giolaqgiolaq/tv-build-harness/skills/kmp-theming/SKILL.md

kmp-theming

Skill4 starsChanged 5 months agoMIT-0View on GitHub

Compose MaterialTheme patterns: Color.kt, Typography, darkColorScheme, and TV-specific theming for KMP apps

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All major streaming apps (Netflix, Prime Video, Disney+) are dark

    line 115
  2. Very specific:

    If a brand requires light mode, you would need to add a lightColorScheme() and a mode toggle.

    line 117
  3. Distinctive:

    Don't rely solely on color change for focus — motion (scale) is more visible at distance

    line 130
  4. Very specific:

    Using Color(...) literals in composables: Always reference KmptvColors or MaterialTheme.colorScheme.

    line 151
  5. Distinctive:

    Focus indication by color alone: Add scale or border. Color-blind users and distance viewing both need redundant cues.

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

KMP Theming

Theme lives in androidtv-app/src/main/java/com/kmptv/androidtv/theme/. A brand kit becomes a theme via darkColorScheme() customization plus a parallel KmptvColors object for TV-specific surfaces.

File structure

androidtv-app/src/main/java/com/kmptv/androidtv/theme/
├── Color.kt    # KmptvColors object — TV-specific palette outside MaterialTheme
├── Theme.kt    # KMPTVTheme composable wrapping darkColorScheme()
└── Type.kt     # Typography definitions

Two-layer color system

The template uses two complementary color approaches:

Layer 1: MaterialTheme darkColorScheme (Material 3)

private val DarkColorScheme = darkColorScheme(
    primary = Color(0xFF90CAF9),       // CTAs, active states
    secondary = Color(0xFF81C784),     // Secondary actions
    tertiary = Color(0xFFFFB74D),      // Accents, highlights
    background = Color(0xFF0D0D0D),    // App background
    surface = Color(0xFF1E1E1E),       // Card surfaces
    onPrimary = Color(0xFF000000),     // Text on primary
    onSecondary = Color(0xFF000000),
    onTertiary = Color(0xFF000000),
    onBackground = Color(0xFFFFFFFF),  // Body text
    onSurface = Color(0xFFFFFFFF),     // Text on cards
)

Access via MaterialTheme.colorScheme.primary, etc.

Layer 2: KmptvColors object (TV-specific)

object KmptvColors {
    val Background = Color(0xFF0D0D0D)      // Near-black, avoids LCD haloing
    val SurfaceElevated = Color(0xFF1A1A1A) // Panels above background
    val SurfaceFocus = Color(0xFF2A2A2A)    // Unfocused controls
    val Accent = Color(0xFFE50914)          // Seek-bar, progress (brand red)
}

Direct reference: KmptvColors.Background. Used where MaterialTheme semantics don't map well to TV patterns (hero gradients, player controls, surface hierarchy).

Applying brand colors

To rebrand the app:

  1. Edit Color.kt — change KmptvColors values to match the brand palette.
  2. Edit Theme.kt — update darkColorScheme() parameters.
  3. Keep them in sync — KmptvColors.Background should match background in the scheme.

Mapping brand.json to KMP theme

Brand fieldGoes toNotes
primary_colordarkColorScheme(primary = ...)CTAs, active states
accent_colorKmptvColors.Accent + tertiaryFocus highlights, progress bars
background_colorBoth background and KmptvColors.BackgroundMust be identical
font_familyType.kt font familyUse Google Fonts or system

Typography

val Typography = Typography(
    headlineLarge = TextStyle(
        fontWeight = FontWeight.Bold,
        fontSize = 48.sp,
        lineHeight = 56.sp,
    ),
    titleMedium = TextStyle(
        fontWeight = FontWeight.SemiBold,
        fontSize = 20.sp,
    ),
    bodyLarge = TextStyle(
        fontSize = 24.sp,
        lineHeight = 32.sp,
    ),
    bodyMedium = TextStyle(
        fontSize = 18.sp,
        lineHeight = 24.sp,
    ),
    labelSmall = TextStyle(
        fontSize = 12.sp,
    ),
)

TV-specific typography rules

  • Body minimum: 18sp, but prefer 24sp for primary content. Anything smaller is unreadable from couch distance.
  • Headlines: 48-64sp. The hero banner uses headlineLarge.
  • Font weight: Bold for headings, SemiBold for row titles, Regular for body. Avoid Light/Thin — they disappear on TVs.
  • Line height: 1.3-1.4x font size. Tight spacing hurts at 10-foot distance.

TV-specific design decisions

Always dark theme

TV apps default dark. The template only defines darkColorScheme() — no light variant. Rationale:

  • TVs are viewed in dim rooms
  • Bright backgrounds cause eye strain and LCD bloom
  • All major streaming apps (Netflix, Prime Video, Disney+) are dark

If a brand requires light mode, you would need to add a lightColorScheme() and a mode toggle. This is rare for TV.

High contrast for focus states

Focus visibility is critical at 10 feet. The template uses:

  • White border (2dp) on focused cards via .border(2.dp, Color.White, shape)
  • Scale animation (1.0 -> 1.08) on focus
  • Shadow elevation (16dp) on focused items
  • Surface tonal elevation change (2dp unfocused -> 8dp focused)

When rebranding, ensure:

  • Focus border color contrasts >= 4.5:1 against the card background
  • Scale + border together make focus obvious from across the room
  • Don't rely solely on color change for focus — motion (scale) is more visible at distance

Surface hierarchy

The template uses a 3-level dark surface system:

  1. Background (0xFF0D0D0D) — page background
  2. SurfaceElevated (0xFF1A1A1A) — cards, panels
  3. SurfaceFocus (0xFF2A2A2A) — interactive elements at rest

Each level is subtly lighter than the previous. This creates depth without bright colors.

Gradient overlays

The hero banner uses overlays for text legibility:

  • Vertical gradient (transparent -> background) from middle to bottom
  • Horizontal gradient (background with alpha -> transparent) on the left side

These ensure text is always readable regardless of the background image.

Anti-patterns

  • Using Color(...) literals in composables. Always reference KmptvColors or MaterialTheme.colorScheme. Scattered hex codes break theming.
  • Light backgrounds for TV. Causes eye strain, LCD bloom, and looks wrong next to every other app in the launcher.
  • Thin/hairline fonts. Invisible from 10 feet. Minimum weight 400.
  • Focus indication by color alone. Add scale or border. Color-blind users and distance viewing both need redundant cues.
  • Separate color objects per screen. One KmptvColors, one darkColorScheme(). Consistency comes from centralization.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.