Skip to content

feat: integrate PvotLib design-system for light/dark theming#13

Open
sxivansx wants to merge 8 commits into
mainfrom
feat/pvot-theming
Open

feat: integrate PvotLib design-system for light/dark theming#13
sxivansx wants to merge 8 commits into
mainfrom
feat/pvot-theming

Conversation

@sxivansx

@sxivansx sxivansx commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #10

Replaces the hand-rolled MaterialTheme setup with PvotLib's PvotAppTheme, and sources all calculator color tokens directly from PvotLib's design-system palette instead of locally-defined raw hex values.

What changed

  • settings.gradle.kts — added includeBuild("../PvotLib") to wire the local composite build
  • app/build.gradle.kts — added implementation(project(":design-system")) to pull the PvotLib design-system module
  • Theme.ktCalculatorTheme now wraps PvotAppTheme; M3 color scheme and typography are owned by PvotLib, not duplicated here
  • CalculatorColors.ktDarkCalculatorColors and LightCalculatorColors fully sourced from PvotLib tokens (PvotBackgroundDark/Light, PvotSurfaceVariantDark/Light, PvotSecondaryContainerDark/Light, etc.)
  • Color.kt — stripped to only CalcOrange (operator button accent; no warm-orange equivalent in PvotLib)

Color token mapping

Slot Dark Light
background PvotBackgroundDark #000000 PvotBackgroundLight #FFFFFF
displayText PvotOnBackgroundDark #E6E1E6 PvotOnBackgroundLight #1C1B1F
expressionText PvotOnSurfaceVariantDark #CAC4CF PvotOnSurfaceVariantLight #49454E
digitButton PvotSurfaceVariantDark #49454E PvotSurfaceVariantLight #E7E0EC
digitButtonText PvotOnSurfaceDark #E6E1E6 PvotOnSurfaceVariantLight #49454E
functionButton PvotSecondaryContainerDark #494458 PvotSecondaryContainerLight #E6DFF9
functionButtonText PvotOnSecondaryContainerDark #E6DFF9 PvotOnSecondaryContainerLight #1C192B
operatorButton CalcOrange #FF9F0A CalcOrange #FF9F0A
operatorButtonText PvotOnPrimaryLight #FFFFFF PvotOnPrimaryLight #FFFFFF

Test plan

  • Build and run on device/emulator
  • Toggle system dark/light mode — colors switch correctly
  • All button types (digit, function, operator) visually distinct in both modes
  • Display text and expression text legible in both modes

sxivansx added 8 commits April 4, 2026 18:31
- Remove temporary android:screenOrientation="portrait" lock from manifest
- Add orientation detection in CalculatorScreen using LocalConfiguration
- Landscape layout: Column with compact 2-line display (expression + value)
  at top-right and full-width keypad below; display height is fixed so the
  keyboard never shifts when expression appears or disappears
- Landscape keypad: 5-column × 4-row grid of pill-shaped (stadium) buttons
  sized via BoxWithConstraints to fill available height/width exactly;
  button arrangement mirrors the reference design:
    Row 1: 7  8  9  ⌫  ÷
    Row 2: 4  5  6  AC ×
    Row 3: 1  2  3  %  −
    Row 4: +/− 0  .  =  +
- Portrait layout unchanged; refactored into PortraitKeypadLayout with
  clean BoxWithConstraints sizing and fixed WideCalcButton width formula
  (buttonSize×2 + spacing) that eliminates the previous 6dp row overflow
- CalculatorDisplay extracted as private composable shared by both orientations
Introduce semantic color tokens via CalculatorColors + CompositionLocal
so the UI automatically switches between dark and light themes based on
the system setting — no hardcoded color constants in composables.

Changes:
- Color.kt: add raw light-mode color values (background, buttons, text)
- CalculatorColors.kt: new @immutable data class with semantic slots
  (background, displayText, expressionText, digitButton/Text,
  functionButton/Text, operatorButton/Text); DarkCalculatorColors and
  LightCalculatorColors instances; LocalCalculatorColors CompositionLocal
- Theme.kt: detect isSystemInDarkTheme(), provide LocalCalculatorColors
  via CompositionLocalProvider, add LightColorScheme for Material3
- CalculatorScreen.kt: read LocalCalculatorColors.current for background,
  displayText and expressionText — remove CalcBlack/White/LightGray imports
- CalculatorKeypad.kt: read LocalCalculatorColors.current in both
  LandscapeKeypadLayout and PortraitKeypadLayout; pass semantic color
  tokens to every button — remove all raw CalcXxx color imports
- MainActivity.kt: replace hardcoded containerColor = Color.Black with
  Color.Unspecified so the screen's own background drives the color
- includeBuild("../PvotLib") wires the local composite build
- implementation(project(":design-system")) pulls the design-system module
Replace locally-defined raw color constants with PvotLib's semantic tokens:
- Dark: PvotBackgroundDark, PvotSurfaceVariantDark, PvotSecondaryContainerDark, etc.
- Light: PvotBackgroundLight, PvotSurfaceVariantLight, PvotSecondaryContainerLight, etc.
- CalcOrange kept for operator buttons (no PvotLib equiv for the brand accent)

Color.kt now only holds CalcOrange; all other palette values come from PvotLib.
CalculatorTheme now wraps PvotAppTheme (from PvotLib design-system) instead
of constructing a raw MaterialTheme with local color schemes. PvotAppTheme
owns the M3 color scheme + typography; LocalCalculatorColors is provided
inside it for calc-specific semantic tokens.
CI uses PVOT-OSS/workflows android-build.yml which checks out submodules
recursively. The previous includeBuild("../PvotLib") only worked locally;
adding PvotLib as a submodule at libs/PvotLib makes the path stable on
both local machines and CI runners.
CLAUDE.md was accidentally committed — Claude context files are local only
and should never be tracked. Adding .claude/ to .gitignore prevents this
from happening again.
@sxivansx

Copy link
Copy Markdown
Collaborator Author

@danascape this user PVOT theming but is failing build test

@danascape

Copy link
Copy Markdown
Member

@danascape this user PVOT theming but is failing build test

weird, submodule should work
lemme try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] implement light mode

2 participants