The res/values-night module serves as the visual foundation for the application’s dark mode experience. It implements the (M3) specification, ensuring that the UI remains legible, accessible, and aesthetically consistent when the user toggles their system-wide dark theme.The primary goal of this module is to map high-level to specific dark-optimized color values, reducing eye strain and preserving battery life on OLED screens.
Styling in Android follows a hierarchical inheritance model. The Theme.ScrollLess style acts as a global configuration object that the Android system injects into every Activity and View.
The core definition. It inherits from Theme.Material3.DayNight.NoActionBar, which provides a baseline for reactive light/dark switching while removing the legacy Android ActionBar in favor of modern Toolbars or Jetpack Compose TopAppBars.
Beyond standard M3 attributes, this module defines a custom set of chartColor attributes. This suggests the application includes a layer that requires a distinct, high-contrast color palette to remain readable against dark backgrounds.
When the user enables Dark Mode, the Android OS triggers a . The system looks into the values-night qualifier folder to override the default light-mode values.
The theme doesn’t manage “state” in the traditional sense of a , but it provides the visual state for the entire UI tree. By using ?attr/colorPrimary in layouts instead of @color/xml_colorPrimaryDark, the UI automatically updates its appearance without requiring manual logic in the code.
While this is a resource module, it performs a critical “mapping” transformation:
Semantic Role
Source Data (Dark Palette)
Purpose
colorSurface
@color/xml_colorSurfaceDark
Backgrounds for cards and sheets.
colorOnSurface
@color/xml_colorOnSurfaceDark
Text and icons on top of surface colors.
chartColor1..5
@color/xml_chartColor1..5
Categorical data differentiation in graphs.
Performance Note: Resource lookups are highly optimized by the Android Asset Manager. By using the res/values-night qualifier, the system performs the “filter” logic at the OS level, ensuring zero overhead on the main thread during UI rendering.