0Pricing
Jetpack Compose Academy · Lesson

MaterialTheme & Color Schemes

Define your app palette in one place.

MaterialTheme & Color Schemes is a free Jetpack Compose Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Jetpack Compose Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Theme to Rule Them

MaterialTheme is the wrapper that hands colors, fonts, and shapes to every Composable inside it, so you style your app in one place. 🎨

Wrap Your App

You usually wrap your whole UI in your app theme, which calls MaterialTheme at its core. Everything inside then reads from that single source.

AppTheme {
  // your screens go here
}

The colorScheme Slot

The first thing colorScheme defines is your palette: the named colors every Material component reaches for automatically.

MaterialTheme(
  colorScheme = lightColorScheme()
) { /* app */ }

Roles, Not Raw Colors

Material 3 uses color roles like primary and surface instead of raw hex everywhere, so components stay consistent and easy to retheme.

primary & onPrimary

The primary role is your brand color for key actions, and onPrimary is the readable color drawn on top of it, like white text on a blue button.

Surfaces & Backgrounds

The surface and background roles paint cards, sheets, and the screen behind everything, while onSurface keeps content legible on them.

Build a Light Scheme

You craft a palette with lightColorScheme, overriding only the roles you care about and letting sensible defaults fill the rest.

val scheme = lightColorScheme(
  primary = Color(0xFF1A73E8)
)

Read a Color in Code

Inside any Composable you grab theme colors through MaterialTheme.colorScheme, so a color change in the theme flows everywhere at once.

val c = MaterialTheme.colorScheme.primary

Tint a Surface

Pass a role into a Composable and it stays on-theme; here a Surface paints itself with the primary color from the active colorScheme.

Surface(color = MaterialTheme.colorScheme.primary) {
  Text("Hi")
}

Container Roles

Roles like primaryContainer give softer, tonal backgrounds for chips and highlights, paired with onPrimaryContainer for their text.

Retheme in Seconds

Because components ask the theme for colors, swapping one colorScheme instantly restyles the entire app, with no per-widget edits. ✨

Quick Check

Where do your app-wide colors live in Material 3?

Recap: One Palette, Everywhere

You wrapped your app in MaterialTheme, defined a colorScheme of roles, and read colors back in code so one palette styles the whole UI. 🎉

Frequently asked questions

Is the “MaterialTheme & Color Schemes” lesson free?

Yes — the full text of “MaterialTheme & Color Schemes” is free to read here on the web, and the Jetpack Compose Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Jetpack Compose Academy course, upgrade to CoddyKit PRO.

What will I learn in “MaterialTheme & Color Schemes”?

Define your app palette in one place. You practise Jetpack Compose Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Jetpack Compose Academy?

No prior experience is required. Jetpack Compose Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “MaterialTheme & Color Schemes” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Jetpack Compose Academy lesson?

Yes. Every Jetpack Compose Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. MaterialTheme & Color Schemes
  2. Typography & Shape Tokens
  3. Dark Mode & Dynamic Color
  4. Building a Custom Design System
← Back to Jetpack Compose Academy