カスタムデザインシステムを作る
独自のトークンでテーマを拡張します。
「カスタムデザインシステムを作る」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Beyond the Defaults
Real brands need more than Material's built-ins. A design system bundles your colors, type, shapes, and extra tokens into one reusable theme. 🏗️
Wrap MaterialTheme
You start by writing your own AppTheme Composable that configures MaterialTheme, giving the whole app a single, named entry point.
@Composable
fun AppTheme(content: @Composable () -> Unit) { /* ... */ }Pass Your Tokens In
Inside AppTheme you hand MaterialTheme your custom colorScheme, typography, and shapes, so every screen inherits your brand automatically.
MaterialTheme(
colorScheme = brandColors,
typography = brandType,
shapes = brandShapes
) { content() }Material Misses Some Tokens
Some brand values, like a success green or a custom spacing unit, have no Material role. You add these as your own extra tokens.
Hold Extra Colors
You group extra colors in a small data class, a tidy home for brand values Material does not provide out of the box.
data class BrandColors(
val success: Color,
val warning: Color
)CompositionLocal
To share custom tokens down the tree without passing parameters, you use a CompositionLocal, Compose's built-in ambient value mechanism.
Create the Local
You declare a staticCompositionLocalOf with a default, creating a channel any Composable can read your brand colors from.
val LocalBrand = staticCompositionLocalOf { defaultBrand }Provide the Values
In AppTheme you wrap content in a CompositionLocalProvider, feeding your brand tokens into the tree alongside MaterialTheme.
CompositionLocalProvider(LocalBrand provides brand) {
MaterialTheme(/* ... */) { content() }
}Read Custom Tokens
Anywhere below, a Composable reads LocalBrand.current to grab your custom values, mirroring how MaterialTheme exposes its own.
val success = LocalBrand.current.successOffer a Clean API
Many teams expose an object so calls read like AppTheme.brand.success, a friendly facade over the CompositionLocal underneath.
One Source of Truth
Now colors, type, shapes, and custom tokens all flow from a single theme, so the app stays consistent and effortless to evolve. ✨
Quick Check
You need a brand color Material has no role for, shared app-wide. What do you reach for?
Recap: Your Own Theme
You wrapped MaterialTheme in an AppTheme, added extra tokens via CompositionLocal, and gave your app one branded source of truth. 🎉
よくある質問
「カスタムデザインシステムを作る」レッスンは無料ですか?
はい。「カスタムデザインシステムを作る」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。
「カスタムデザインシステムを作る」で何を学びますか?
独自のトークンでテーマを拡張します。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Jetpack Compose Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「カスタムデザインシステムを作る」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このJetpack Compose Academyレッスンでコードを書いて実行できますか?
はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- MaterialThemeとカラースキーム
- タイポグラフィとシェイプトークン
- ダークモードとDynamic Color
- カスタムデザインシステムを作る