Skip to content
Back to skills

Android Design System

ASecurity

Keep palette values in `Color.kt`, map semantic roles separately for light and dark schemes, and choose the scheme once in `Theme.kt`. Composables should only read `MaterialTheme.colorScheme`. ```kotlin // ui/theme/Color.kt private val BrandLight = Color(0xFF6750A4) private val BrandDark = Color(0xFFD0BCFF) private val OnBrandLight = Color(0xFFFFFFFF) private val OnBrandDark = Color(0xFF381E72) val LightColors = lightColorScheme( primary = BrandLight, onPrimary = OnBrandLight, ) val DarkColor...

  • 584 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
developmentkotlinapi

Works with

  • api

Security analysis

A100/100

Pro scans all 18 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-design-system --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Design System?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Design System
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-android-design-system-b904996f/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-design-system-b904996f)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Supporting dark mode with one theme API

Keep palette values in `Color.kt`, map semantic roles separately for light and dark schemes, and choose the scheme once in `Theme.kt`. Composables should only read `MaterialTheme.colorScheme`.

```kotlin
// ui/theme/Color.kt
private val BrandLight = Color(0xFF6750A4)
private val BrandDark = Color(0xFFD0BCFF)
private val OnBrandLight = Color(0xFFFFFFFF)
private val OnBrandDark = Color(0xFF381E72)

val LightColors = lightColorScheme(
    primary = BrandLight,
    onPrimary = OnBrandLight,
)

val DarkColors = darkColorScheme(
    primary = BrandDark,
    onPrimary = OnBrandDark,
)
```

The palette constants are defined once; only the semantic role mapping differs where contrast requires a different tone. Add all app-specific colors to both scheme definitions instead of scattering light/dark checks through screens.

```kotlin
// ui/theme/Theme.kt
@Composable
fun AppTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit,
) {
    val colors = if (darkTheme) DarkColors else LightColors

    MaterialTheme(
        colorScheme = colors,
        typography = AppTypography,
        content = content,
    )
}
```

Now every screen automatically follows the selected scheme:

```kotlin
@Composable
fun SurfaceContent() {
    Surface(color = MaterialTheme.colorScheme.background) {
        Text(
            text = "Content",
            color = MaterialTheme.colorScheme.onBackground,
            style = MaterialTheme.typography.bodyLarge,
        )
    }
}
```

`isSystemInDarkTheme()` responds to the system setting, while a caller can pass `darkTheme` explicitly for an in-app preference or preview. The UI remains unchanged because it consumes semantic tokens rather than duplicating color definitions or branching on dark mode.

Files in this skill

  • eval-1.baseline.md1.6 KB
  • eval-1.with-skill.md1.4 KB
  • eval-2.baseline.md2 KB
  • eval-2.with-skill.md1.4 KB
  • eval-3.baseline.md1.8 KB
  • eval-3.with-skill.md1.8 KB
  • trigger-1.md112 B
  • trigger-10.md112 B
  • trigger-11.md108 B
  • trigger-2.md122 B
  • trigger-3.md101 B
  • trigger-4.md127 B
  • trigger-5.md129 B
  • trigger-6.md126 B
  • trigger-7.md111 B
  • trigger-8.md111 B
  • trigger-9.md100 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.