Jetpack Compose Academy · درس

‏MaterialTheme وأنظمة الألوان

حدّد لوحة ألوان تطبيقك في مكان واحد

الدرس 1 من 413 خطوة

‏MaterialTheme وأنظمة الألوان درس مجاني في Jetpack Compose Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في 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. 🎉

البدء مجانًا

تعلم Kotlin مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
30
الدروس
120

الأسئلة الشائعة

هل درس «‏MaterialTheme وأنظمة الألوان» مجاني؟

نعم — نص درس «‏MaterialTheme وأنظمة الألوان» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Jetpack Compose Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Jetpack Compose Academy 4 دروس في المجموع.

ماذا ستتعلم في «‏MaterialTheme وأنظمة الألوان»؟

حدّد لوحة ألوان تطبيقك في مكان واحد تتمرن على Jetpack Compose Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Jetpack Compose Academy؟

لا تُشترط خبرة سابقة. Jetpack Compose Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.

كم من الوقت يستغرق درس «‏MaterialTheme وأنظمة الألوان»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Jetpack Compose Academy هذا؟

نعم. كل درس في Jetpack Compose Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. ‏MaterialTheme وأنظمة الألوان
  2. الطباعة ورموز الأشكال
  3. الوضع الداكن واللون الديناميكي
  4. بناء نظام تصميم مخصص
← العودة إلى Jetpack Compose Academy