Skip to content

Support $Dark UIID styles in dark mode with implicit inheritance#4648

Merged
shai-almog merged 3 commits intomasterfrom
codex/implement-dark-mode-style-inheritance
Mar 28, 2026
Merged

Support $Dark UIID styles in dark mode with implicit inheritance#4648
shai-almog merged 3 commits intomasterfrom
codex/implement-dark-mode-style-inheritance

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Motivation

  • Ensure when dark mode is enabled the UIManager prefers theme styles with a $Dark prefix for a UIID if they exist.
  • Make dark variants inherit from the original (non-dark) style by default so themes can override only the differences.
  • Allow explicit derive on $Dark styles to override the implicit inheritance behavior.

Description

  • Modified UIManager.createStyle(...) to check CN.isDarkMode() and resolve to a $Dark<UIID> variant when present via a new shouldUseDarkStyle(...) helper.
  • When a $Dark variant exists but does not define its own derive, the code now implicitly derives it from the original UIID using toDeriveStyleName(...), preserving existing explicit derive behavior.
  • Added helper hasStyleDefinition(...) to detect whether the dark variant is defined in themeProps.
  • Added unit tests maven/core-unittests/src/test/java/com/codename1/ui/plaf/UIManagerDarkModeStyleTest.java that cover: dark-style override + inherited base properties, selected-style dark variants (sel#), explicit dark derive overriding implicit inheritance, and fallback to the regular style when no $Dark variant exists; tests reset dark mode after each run.

Testing

  • Added and committed the code and test files, then attempted to run the new tests with:
    • export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && export PATH="$JAVA_HOME/bin:$PATH" && cd maven && mvn -pl core-unittests -am -DunitTests=true -Dmaven.javadoc.skip=true -Plocal-dev-javase -Dtest=UIManagerDarkModeStyleTest test which failed because the referenced Java 8 path is not available in this environment.
  • Re-ran with an available JDK but Maven could not complete due to external dependency resolution failures from Maven Central (HTTP 403), so the test suite could not be executed here.
  • The new tests are included in the PR and should pass in CI or a local environment configured per AGENTS.md (Java 8 JAVA_HOME + Maven access to central).

Codex Task

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Mar 28, 2026

Compared 32 screenshots: 32 matched.

Native Android coverage

  • 📊 Line coverage: 7.50% (3826/50985 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.91% (18948/320532), branch 2.79% (870/31131), complexity 3.51% (1046/29784), method 6.20% (861/13887), class 10.32% (190/1841)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 7.50% (3826/50985 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.91% (18948/320532), branch 2.79% (870/31131), complexity 3.51% (1046/29784), method 6.20% (861/13887), class 10.32% (190/1841)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented Mar 28, 2026

iOS screenshot updates

Compared 32 screenshots: 31 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 149 seconds

Detailed Performance Metrics

Metric Duration
Simulator Boot 1000 ms
Simulator Boot (Run) 2000 ms
App Install 6000 ms
App Launch 8000 ms
Test Execution 202000 ms

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@github-actions
Copy link
Copy Markdown

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: 1 issue(s) flagged (1 errors) (exit code 1) (report)
  • Vale: 18574 alert(s) (2701 errors, 6342 warnings, 9531 suggestions) (exit code 1) (report)
  • Image references: 33 unused image(s) found (report)

Unused image preview:

  • img/uwp-app-manager-apps.png
  • img/uwp-certificate-generator.png
  • img/uwp-cn1settings-debug-desktop-selected.png
  • img/uwp-cn1settings-disk-icon.png
  • img/uwp-cn1settings-uwp.png
  • img/uwp-cn1settings-windows-settings-menu-item.png
  • img/uwp-dashboard-download-appxbundle.png
  • img/uwp-extract-zip-file.png
  • img/uwp-mobile-recently-added.png
  • img/uwp-mobile-settings-developer-mode.png
  • ... and 23 more

@shai-almog shai-almog merged commit 2f5dd00 into master Mar 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant