这是indexloc提供的服务,不要输入任何密码
Skip to content

Add support for custom dark mode #11191

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tjclawson-stripe
Copy link
Collaborator

@tjclawson-stripe tjclawson-stripe commented Jul 22, 2025

Summary

Moves drawable-night PM icons to /drawable and renames to stripe_ic_<pm>_night
Renames light mode drawables to stripe_ic_<pm>_day
Update iconUrl logic to check luminance of component
Add iconResourceNight to SupportedPaymentMethod and DisplayablePaymentMethod

Motivation

Support custom dark themes

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
Screenshot_1753475271 Screenshot_1753475337

Changelog

Copy link
Contributor

github-actions bot commented Jul 22, 2025

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │           compressed           │           uncompressed           
          ├──────────┬──────────┬──────────┼───────────┬───────────┬──────────
 APK      │ old      │ new      │ diff     │ old       │ new       │ diff     
──────────┼──────────┼──────────┼──────────┼───────────┼───────────┼──────────
      dex │  4.7 MiB │  4.7 MiB │   +828 B │  10.4 MiB │  10.4 MiB │ +1.1 KiB 
     arsc │  2.5 MiB │  2.5 MiB │ +1.1 KiB │   2.5 MiB │   2.5 MiB │ +1.1 KiB 
 manifest │  5.8 KiB │  5.8 KiB │      0 B │  30.1 KiB │  30.1 KiB │      0 B 
      res │  918 KiB │  918 KiB │     +6 B │   1.5 MiB │   1.5 MiB │      0 B 
   native │  3.5 MiB │  3.5 MiB │      0 B │   8.5 MiB │   8.5 MiB │      0 B 
    asset │  1.6 MiB │  1.6 MiB │ -1.4 KiB │   1.6 MiB │   1.6 MiB │ -1.4 KiB 
    other │  198 KiB │  198 KiB │    -16 B │ 373.9 KiB │ 373.9 KiB │     +2 B 
──────────┼──────────┼──────────┼──────────┼───────────┼───────────┼──────────
    total │ 13.5 MiB │ 13.5 MiB │   +472 B │  24.9 MiB │  24.9 MiB │   +804 B 

         │         raw          │              unique              
         ├───────┬───────┬──────┼───────┬───────┬──────────────────
 DEX     │ old   │ new   │ diff │ old   │ new   │ diff             
─────────┼───────┼───────┼──────┼───────┼───────┼──────────────────
   files │     2 │     2 │    0 │       │       │                  
 strings │ 53170 │ 53172 │   +2 │ 49313 │ 49314 │ +1 (+16 -15)     
   types │ 19099 │ 19098 │   -1 │ 17178 │ 17177 │ -1 (+8 -9)       
 classes │ 14516 │ 14515 │   -1 │ 14516 │ 14515 │ -1 (+1 -2)       
 methods │ 73933 │ 73933 │    0 │ 70996 │ 70995 │ -1 (+1421 -1422) 
  fields │ 48170 │ 48174 │   +4 │ 47046 │ 47049 │ +3 (+447 -444)   

 ARSC    │ old  │ new  │ diff         
─────────┼──────┼──────┼──────────────
 configs │  242 │  242 │  0           
 entries │ 6329 │ 6338 │ +9 (+21 -12)
APK
      compressed      │     uncompressed     │                                
───────────┬──────────┼───────────┬──────────┤                                
 size      │ diff     │ size      │ diff     │ path                           
───────────┼──────────┼───────────┼──────────┼────────────────────────────────
   2.3 KiB │ +2.3 KiB │     5 KiB │   +5 KiB │ + res/-z.xml                   
           │ -2.3 KiB │           │   -5 KiB │ - res/Xw.xml                   
   2.1 KiB │ +2.1 KiB │   5.3 KiB │ +5.3 KiB │ + res/WG.xml                   
           │ -2.1 KiB │           │ -5.3 KiB │ - res/P6.xml                   
   1.9 KiB │ +1.9 KiB │   5.2 KiB │ +5.2 KiB │ + res/VF.xml                   
           │ -1.9 KiB │           │ -5.2 KiB │ - res/8K.xml                   
   1.8 KiB │ +1.8 KiB │   4.7 KiB │ +4.7 KiB │ + res/pP.xml                   
           │ -1.8 KiB │           │ -4.7 KiB │ - res/M4.xml                   
   1.5 KiB │ +1.5 KiB │     3 KiB │   +3 KiB │ + res/s41.xml                  
   1.4 KiB │ +1.4 KiB │   2.9 KiB │ +2.9 KiB │ + res/Hf1.xml                  
           │ -1.4 KiB │           │ -2.9 KiB │ - res/qq.xml                   
   7.8 KiB │ -1.4 KiB │   7.7 KiB │ -1.4 KiB │ ∆ assets/dexopt/baseline.prof  
   1.3 KiB │ +1.3 KiB │     3 KiB │   +3 KiB │ + res/mS.xml                   
           │ -1.3 KiB │           │   -3 KiB │ - res/5U.xml                   
           │ -1.3 KiB │           │   -3 KiB │ - res/rh.xml                   
   1.3 KiB │ +1.3 KiB │   2.8 KiB │ +2.8 KiB │ + res/EZ.xml                   
           │ -1.3 KiB │           │ -2.8 KiB │ - res/Fh.xml                   
           │ -1.3 KiB │           │ -2.8 KiB │ - res/j21.xml                  
   1.3 KiB │ +1.3 KiB │   2.8 KiB │ +2.8 KiB │ + res/3_.xml                   
   1.2 KiB │ +1.2 KiB │   2.2 KiB │ +2.2 KiB │ + res/2K.xml                   
           │ -1.2 KiB │           │ -2.2 KiB │ - res/JR.xml                   
           │ -1.2 KiB │           │ -2.4 KiB │ - res/Vo.xml                   
           │ -1.2 KiB │           │ -2.4 KiB │ - res/LK.xml                   
   2.5 MiB │ +1.1 KiB │   2.5 MiB │ +1.1 KiB │ ∆ resources.arsc               
   1,006 B │ +1,006 B │   2.1 KiB │ +2.1 KiB │ + res/yc.xml                   
           │ -1,006 B │           │ -2.1 KiB │ - res/7l.xml                   
     968 B │   +968 B │   1.6 KiB │ +1.6 KiB │ + res/ED.xml                   
           │   -968 B │           │ -1.6 KiB │ - res/XF.xml                   
     963 B │   +963 B │   1.6 KiB │ +1.6 KiB │ + res/9Q.xml                   
           │   -963 B │           │ -1.6 KiB │ - res/NR.xml                   
     939 B │   +939 B │   1.9 KiB │ +1.9 KiB │ + res/-R.xml                   
           │   -932 B │           │ -1.9 KiB │ - res/yV1.xml                  
     930 B │   +930 B │   1.9 KiB │ +1.9 KiB │ + res/T_.xml                   
   1.2 KiB │   +864 B │   2.4 KiB │   +2 KiB │ ∆ res/Ta.xml                   
   4.2 MiB │   +861 B │   9.3 MiB │ +1.1 KiB │ ∆ classes.dex                  
     854 B │   +854 B │   1.6 KiB │ +1.6 KiB │ + res/JI.xml                   
           │   -854 B │           │ -1.6 KiB │ - res/qd.xml                   
   1.3 KiB │   +831 B │     3 KiB │ +2.2 KiB │ ∆ res/D5.xml                   
     549 B │   +549 B │     812 B │   +812 B │ + res/D51.xml                  
     401 B │   -538 B │     688 B │ -1.2 KiB │ ∆ res/rW.xml                   
     464 B │   +464 B │     864 B │   +864 B │ + res/zN.xml                   
           │   -464 B │           │   -864 B │ - res/qj.xml                   
     462 B │   +462 B │     864 B │   +864 B │ + res/NO.xml                   
           │   -462 B │           │   -864 B │ - res/c3.xml                   
     453 B │   +453 B │     788 B │   +788 B │ + res/Jx.xml                   
           │   -453 B │           │   -788 B │ - res/jK.xml                   
           │   -403 B │           │   -688 B │ - res/rW1.xml                  
     316 B │   +316 B │     388 B │   +388 B │ + res/Ta1.xml                  
   1.2 KiB │   -300 B │   2.4 KiB │   -596 B │ ∆ res/s4.xml                   
 482.5 KiB │    -33 B │   1.1 MiB │    +28 B │ ∆ classes2.dex                 
  54.8 KiB │    -13 B │ 121.7 KiB │     +1 B │ ∆ META-INF/CERT.SF             
   1.2 KiB │     +8 B │     1 KiB │     +8 B │ ∆ assets/dexopt/baseline.profm 
   1.2 KiB │     -2 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA          
...✂
DEX
STRINGS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   49313 │ 49314 │ +1 (+16 -15) 
  
  + , iconResourceNight=
  + IILLL
  + Ly7/t;
  + VLLIILZLLI
  + VLLILLLZLLI
  + VLLLILLLZLL
  + VLLLILLLZLLLL
  + VLZILLLZLL
  + [Lfa/n1;
  + [Lfa/r1;
  + [Lfa/t1;
  + [Ly7/t;
  + [Lz1/B;
  + [Lz1/G;
  + [Lz1/z;
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"0329644","r8-mode":"full","version":"8.8.34"}
  
  - Lfa/i2;
  - Lz1/N;
  - VLLIIZLLI
  - VLLILLZLLI
  - VLLLILLZLL
  - VLLLILLZLLLL
  - VLZILLZLL
  - [Lfa/o1;
  - [Lfa/s1;
  - [Lfa/u1;
  - [Ly7/s;
  - [Lz1/A;
  - [Lz1/C;
  - [Lz1/H;
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"b89df0e","r8-mode":"full","version":"8.8.34"}
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   17178 │ 17177 │ -1 (+8 -9) 
  
  + Ly7/t;
  + [Lfa/n1;
  + [Lfa/r1;
  + [Lfa/t1;
  + [Ly7/t;
  + [Lz1/B;
  + [Lz1/G;
  + [Lz1/z;
  
  - Lfa/i2;
  - Lz1/N;
  - [Lfa/o1;
  - [Lfa/s1;
  - [Lfa/u1;
  - [Ly7/s;
  - [Lz1/A;
  - [Lz1/C;
  - [Lz1/H;
  

METHODS:

   old   │ new   │ diff             
  ───────┼───────┼──────────────────
   70996 │ 70995 │ -1 (+1421 -1422) 
  
  + A0.p1 <init>(M, p1)
  + A3.b A(F, Function2, Continuation) → Object
  + A3.b B(Context, Looper, U, Object, h, i) → c
  + A3.b C(int) → int
  + A3.b D(ClassLoader) → ClassLoader
  + A3.b E(j, r, int) → l0
  + A3.b F(byte[][]) → byte[]
  + A3.b G(Context) → r
  + A3.b H(List, boolean, boolean, Function1, boolean, String) → ArrayList
  + A3.b I(int, r) → float
  + A3.b J(int, List) → int
  + A3.b K(int, List) → int
  + A3.b L(ArrayList, float) → int
  + A3.b M(ArrayList, long, Function1)
  + A3.b N(F, Function2, ContinuationImpl) → Object
  + A3.b O(int, int, float[]) → float
  + A3.b P(EdgeEffect) → float
  + A3.b Q(Context, int) → Drawable
  + A3.b R(List, A) → a0
  + A3.b S(z, Layout, e, int, RectF, e, L0, boolean) → int
  + A3.b T(int, r) → String
  + A3.b U(Context) → boolean
  + A3.b V(EdgeEffect, float, float) → float
  + A3.b W(c, r) → String
  + A3.b X(byte[], int, int) → byte[]
  + A3.b Y(String)
  + A3.b Z(String)
  + A3.b a(Function0, p, boolean, l0, T, w, h0, U, Function3, r, int, int)
  + A3.b a0(String)
  + A3.b b(J, r, int)
  + A3.b c(U, j0, p0, int, Function1, l0, l0, Function1, t1, r, int)
  + A3.b d(String, o, List, boolean, int, Function1, boolean, r, int)
  + A3.b e(e, Function0, Function1, Function1, r, int)
  + A3.b f(e, K, Function1, Function0, r, int)
  + A3.b g(int, r)
  + A3.b h(int, r)
  + A3.b i(ListBuilder, r, int)
  + A3.b j(i, p, r, int)
  + A3.b k(Function0, r, int)
  + A3.b l(String, p, boolean, r, int, int)
  + A3.b m(p, r, int)
  + A3.b n(p, long, r, int)
  + A3.b o(c, e, Function1, Function0, r, int)
  + A3.b p(float, int, String, z, String, boolean, boolean, boolean, String, p, Function0, r, int)
  + A3.b q(s, p, r, int)
  + A3.b r(List, o, L, O, boolean, Function0, Function1, Function1, z, p, r, int)
  + A3.b s(String, p, boolean, r, int, int)
  + A3.b t(o, Function0, Function0, r, int)
  + A3.b u(boolean, L, Function0, Function0, r, int, int)
  + A3.b v(Function0, p, boolean, T, w, h0, c, r, int, int)
  + A3.b w(boolean, Function0, r, int)
  + A3.b x(Activity) → boolean
  + A3.b y(String) → String
  + A3.b z(D, BaseContinuationImpl) → Object
  + A8.c <init>(c, i1, Map)
  + B.a m(String) → K1
  + B4.q a(h1)
  + B4.q b(G, ContinuationImpl) → Object
  + B4.q f(G) → Typeface
  + B6.s <init>(S, Q, G, c, g, d, g, h, d, h0)
  + B7.h <init>(t, H)
  + B9.a g(E1, boolean, boolean, q, r, int)
  + C6.j <init>(E1, E0, E1, d, Function0, int)
  + C6.m <init>(E1, boolean, boolean, q, int)
  + C6.o <init>(E1, boolean, l0, q, boolean)
  + C6.s <init>(q, l0, e, boolean, boolean, E1)
  + C6.t <init>(boolean, List, E1, l0, Integer, Function1)
  + C6.z <init>(String, y1, boolean, String, E0, boolean, y, String)
  + C7.a <init>(c, boolean, int, Integer, String, String, boolean, String, Integer)
  + C8.i <init>(boolean, boolean, E1, e, q, int)
  + D6.q b(l1)
  + D7.a b(LinkedHashMap) → k1
  + D7.b b(LinkedHashMap) → k1
  + D7.c b(LinkedHashMap) → k1
  + D7.d b(LinkedHashMap) → k1
  + D7.h <init>(m, R1, int, int, Integer, boolean, b, Integer, int)
  + D7.h <init>(String, c, int, Integer, String, String, boolean, c, Integer, int)
  + D7.h <init>(String, String, c, int, Integer, String, String, boolean, c, Integer)
  + G8.g <init>(boolean, p1, Object, Object, p, int, int)
...✂
ARSC
ENTRIES:

   old  │ new  │ diff         
  ──────┼──────┼──────────────
   6329 │ 6338 │ +9 (+21 -12) 
  + drawable/_stripe_ic_paymentsheet_pm_mobile_pay_day__0
  + drawable/_stripe_ic_paymentsheet_pm_mobile_pay_day__1
  + drawable/_stripe_ic_paymentsheet_pm_mobile_pay_day__2
  + drawable/stripe_ic_affirm_logo_day
  + drawable/stripe_ic_affirm_logo_night
  + drawable/stripe_ic_paymentsheet_pm_alma_day
  + drawable/stripe_ic_paymentsheet_pm_alma_night
  + drawable/stripe_ic_paymentsheet_pm_billie_day
  + drawable/stripe_ic_paymentsheet_pm_billie_night
  + drawable/stripe_ic_paymentsheet_pm_crypto_day
  + drawable/stripe_ic_paymentsheet_pm_crypto_night
  + drawable/stripe_ic_paymentsheet_pm_mobile_pay_day
  + drawable/stripe_ic_paymentsheet_pm_mobile_pay_night
  + drawable/stripe_ic_paymentsheet_pm_multibanco_day
  + drawable/stripe_ic_paymentsheet_pm_multibanco_night
  + drawable/stripe_ic_paymentsheet_pm_revolut_pay_day
  + drawable/stripe_ic_paymentsheet_pm_revolut_pay_night
  + drawable/stripe_ic_paymentsheet_pm_satispay_day
  + drawable/stripe_ic_paymentsheet_pm_satispay_night
  + drawable/stripe_ic_paymentsheet_pm_sunbit_day
  + drawable/stripe_ic_paymentsheet_pm_sunbit_night
  
  - drawable/_stripe_ic_paymentsheet_pm_mobile_pay__0
  - drawable/_stripe_ic_paymentsheet_pm_mobile_pay__1
  - drawable/_stripe_ic_paymentsheet_pm_mobile_pay__2
  - drawable/stripe_ic_affirm_logo
  - drawable/stripe_ic_paymentsheet_pm_alma
  - drawable/stripe_ic_paymentsheet_pm_billie
  - drawable/stripe_ic_paymentsheet_pm_crypto
  - drawable/stripe_ic_paymentsheet_pm_mobile_pay
  - drawable/stripe_ic_paymentsheet_pm_multibanco
  - drawable/stripe_ic_paymentsheet_pm_revolut_pay
  - drawable/stripe_ic_paymentsheet_pm_satispay
  - drawable/stripe_ic_paymentsheet_pm_sunbit

@tjclawson-stripe tjclawson-stripe force-pushed the tyler/icon-dark-support branch from 2eb78fe to 5a586f4 Compare July 23, 2025 22:19
@tjclawson-stripe tjclawson-stripe marked this pull request as ready for review July 25, 2025 21:47
@tjclawson-stripe tjclawson-stripe requested review from a team as code owners July 25, 2025 21:47
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.

1 participant