0Pricing
Jetpack Compose Academy · レッスン

MaterialThemeとカラースキーム

アプリのカラーパレットを1か所で定義します。

「MaterialThemeとカラースキーム」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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. 🎉

よくある質問

「MaterialThemeとカラースキーム」レッスンは無料ですか?

はい。「MaterialThemeとカラースキーム」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。

「MaterialThemeとカラースキーム」で何を学びますか?

アプリのカラーパレットを1か所で定義します。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Jetpack Compose Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「MaterialThemeとカラースキーム」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このJetpack Compose Academyレッスンでコードを書いて実行できますか?

はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. MaterialThemeとカラースキーム
  2. タイポグラフィとシェイプトークン
  3. ダークモードとDynamic Color
  4. カスタムデザインシステムを作る
← Jetpack Compose Academyに戻る