-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Update Theme.kt in Jetcaster to make the app force dark #1593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @MagicalMeghan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request simplifies the theming implementation for the Jetcaster Android application. It modifies the Theme.kt
file to enforce a dark color theme across the entire application, overriding the device's system-wide dark mode setting and removing support for dynamic theming and light color schemes.
Highlights
- Forced Dark Theme: The Jetcaster application's theme logic has been updated to always apply the
darkScheme
, ensuring a consistent dark mode experience regardless of the device's system settings. - Theme Simplification: All definitions and imports related to light color schemes, dynamic theming, and various contrast variations (medium and high contrast for both light and dark themes) have been removed, streamlining the theme configuration.
- Code Cleanup: The
JetcasterTheme
Composable function has been simplified by removing parameters fordarkTheme
anddynamicColor
, as well as the conditional logic that previously selected between different color schemes.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enforces a dark theme for the Jetcaster app by removing light theme support. The changes simplify the codebase by removing unused theme definitions. A critical issue regarding a breaking API change and medium-severity suggestions for further code cleanup have been identified.
fun JetcasterTheme( | ||
darkTheme: Boolean = isSystemInDarkTheme(), | ||
// Dynamic color is available on Android 12+ | ||
dynamicColor: Boolean = false, | ||
content: @Composable () -> Unit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import com.example.jetcaster.designsystem.theme.surfaceBrightLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerDark | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighDark | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighLight | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestDark | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestLight | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLight | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowDark | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowLight | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestDark | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestLight | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDark | ||
import com.example.jetcaster.designsystem.theme.surfaceDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDimDark | ||
import com.example.jetcaster.designsystem.theme.surfaceDimDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDimDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDimLight | ||
import com.example.jetcaster.designsystem.theme.surfaceDimLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceDimLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceLight | ||
import com.example.jetcaster.designsystem.theme.surfaceLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantDark | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantLight | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.surfaceVariantLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerDark | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerLight | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryContainerLightMediumContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryDark | ||
import com.example.jetcaster.designsystem.theme.tertiaryDarkHighContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryDarkMediumContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryLight | ||
import com.example.jetcaster.designsystem.theme.tertiaryLightHighContrast | ||
import com.example.jetcaster.designsystem.theme.tertiaryLightMediumContrast | ||
|
||
private val lightScheme = lightColorScheme( | ||
primary = primaryLight, | ||
onPrimary = onPrimaryLight, | ||
primaryContainer = primaryContainerLight, | ||
onPrimaryContainer = onPrimaryContainerLight, | ||
secondary = secondaryLight, | ||
onSecondary = onSecondaryLight, | ||
secondaryContainer = secondaryContainerLight, | ||
onSecondaryContainer = onSecondaryContainerLight, | ||
tertiary = tertiaryLight, | ||
onTertiary = onTertiaryLight, | ||
tertiaryContainer = tertiaryContainerLight, | ||
onTertiaryContainer = onTertiaryContainerLight, | ||
error = errorLight, | ||
onError = onErrorLight, | ||
errorContainer = errorContainerLight, | ||
onErrorContainer = onErrorContainerLight, | ||
background = backgroundLight, | ||
onBackground = onBackgroundLight, | ||
surface = surfaceLight, | ||
onSurface = onSurfaceLight, | ||
surfaceVariant = surfaceVariantLight, | ||
onSurfaceVariant = onSurfaceVariantLight, | ||
outline = outlineLight, | ||
outlineVariant = outlineVariantLight, | ||
scrim = scrimLight, | ||
inverseSurface = inverseSurfaceLight, | ||
inverseOnSurface = inverseOnSurfaceLight, | ||
inversePrimary = inversePrimaryLight, | ||
surfaceDim = surfaceDimLight, | ||
surfaceBright = surfaceBrightLight, | ||
surfaceContainerLowest = surfaceContainerLowestLight, | ||
surfaceContainerLow = surfaceContainerLowLight, | ||
surfaceContainer = surfaceContainerLight, | ||
surfaceContainerHigh = surfaceContainerHighLight, | ||
surfaceContainerHighest = surfaceContainerHighestLight, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these imports are no longer used after the removal of light theme support. Removing unused imports keeps the code clean.
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialExpressiveTheme
import androidx.compose.material3.MotionScheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.Composable
import com.example.jetcaster.designsystem.theme.JetcasterShapes
import com.example.jetcaster.designsystem.theme.JetcasterTypography
import com.example.jetcaster.designsystem.theme.backgroundDark
import com.example.jetcaster.designsystem.theme.errorContainerDark
import com.example.jetcaster.designsystem.theme.errorDark
import com.example.jetcaster.designsystem.theme.inverseOnSurfaceDark
import com.example.jetcaster.designsystem.theme.inversePrimaryDark
import com.example.jetcaster.designsystem.theme.inverseSurfaceDark
import com.example.jetcaster.designsystem.theme.onBackgroundDark
import com.example.jetcaster.designsystem.theme.onErrorContainerDark
import com.example.jetcaster.designsystem.theme.onErrorDark
import com.example.jetcaster.designsystem.theme.onPrimaryContainerDark
import com.example.jetcaster.designsystem.theme.onPrimaryDark
import com.example.jetcaster.designsystem.theme.onSecondaryContainerDark
import com.example.jetcaster.designsystem.theme.onSecondaryDark
import com.example.jetcaster.designsystem.theme.onSurfaceDark
import com.example.jetcaster.designsystem.theme.onSurfaceVariantDark
import com.example.jetcaster.designsystem.theme.onTertiaryContainerDark
import com.example.jetcaster.designsystem.theme.onTertiaryDark
import com.example.jetcaster.designsystem.theme.outlineDark
import com.example.jetcaster.designsystem.theme.outlineVariantDark
import com.example.jetcaster.designsystem.theme.primaryContainerDark
import com.example.jetcaster.designsystem.theme.primaryDark
import com.example.jetcaster.designsystem.theme.scrimDark
import com.example.jetcaster.designsystem.theme.secondaryContainerDark
import com.example.jetcaster.designsystem.theme.secondaryDark
import com.example.jetcaster.designsystem.theme.surfaceBrightDark
import com.example.jetcaster.designsystem.theme.surfaceContainerDark
import com.example.jetcaster.designsystem.theme.surfaceContainerHighDark
import com.example.jetcaster.designsystem.theme.surfaceContainerHighestDark
import com.example.jetcaster.designsystem.theme.surfaceContainerLowDark
import com.example.jetcaster.designsystem.theme.surfaceContainerLowestDark
import com.example.jetcaster.designsystem.theme.surfaceDark
import com.example.jetcaster.designsystem.theme.surfaceDimDark
import com.example.jetcaster.designsystem.theme.surfaceVariantDark
import com.example.jetcaster.designsystem.theme.tertiaryContainerDark
import com.example.jetcaster.designsystem.theme.tertiaryDark
darkTheme -> darkScheme | ||
else -> lightScheme | ||
} | ||
val colorScheme = darkScheme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The colorScheme
local variable is now redundant since the theme is always darkScheme
. You can simplify the code by inlining darkScheme
directly into the MaterialExpressiveTheme
call.
MaterialExpressiveTheme(
colorScheme = darkScheme,
motionScheme = MotionScheme.expressive(),
shapes = JetcasterShapes,
typography = JetcasterTypography,
content = content,
)
Updating Jetcaster to only use dark color theme even when device isn't in dark mode