File tree Expand file tree Collapse file tree
java/io/nekohasekai/sagernet/widget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,11 +141,14 @@ class ServiceButton @JvmOverloads constructor(
141141 }
142142
143143 private fun applyStateTint (state : BaseService .State ) {
144- // Tint the connect FAB icon by state: connected=green, stopped=red. For
145- // transient states (and on non-Dracula themes) fall back to colorOnPrimary,
146- // which is the FAB's normal icon color, so those themes look unchanged.
144+ // Tint the connect FAB icon by state. Connected uses fabConnectedColor
145+ // (defaults to the green connected status color, but themes whose FAB
146+ // background is that same green — e.g. Dark High Contrast — override it
147+ // with a contrasting color so the icon stays visible). Stopped uses
148+ // fabStoppedColor. Transient states fall back to colorOnPrimary, the FAB's
149+ // normal icon color, so unaffected themes look unchanged.
147150 val attr = when (state) {
148- BaseService .State .Connected -> R .attr.statusConnectedColor
151+ BaseService .State .Connected -> R .attr.fabConnectedColor
149152 BaseService .State .Stopped -> R .attr.fabStoppedColor
150153 else -> com.google.android.material.R .attr.colorOnPrimary
151154 }
Original file line number Diff line number Diff line change 1111 android : id =" @+id/appbar"
1212 android : layout_width =" match_parent"
1313 android : layout_height =" wrap_content"
14- android : background =" ?attr/colorPrimary " >
14+ android : background =" ?attr/appBarBackgroundColor " >
1515
1616 <com .google.android.material.appbar.CollapsingToolbarLayout
1717 android : layout_width =" match_parent"
2323 android : id =" @+id/toolbar"
2424 android : layout_width =" match_parent"
2525 android : layout_height =" ?attr/actionBarSize"
26- android : background =" ?attr/colorPrimary "
26+ android : background =" ?attr/appBarBackgroundColor "
2727 android : elevation =" 0dp"
2828 android : theme =" ?actionBarTheme"
2929 android : touchscreenBlocksFocus =" false"
Original file line number Diff line number Diff line change 44 android : id =" @+id/appbar"
55 android : layout_width =" match_parent"
66 android : layout_height =" ?attr/actionBarSize"
7- android : background =" ?attr/colorPrimary "
7+ android : background =" ?attr/appBarBackgroundColor "
88 app : elevation =" 0dp"
99 app : liftOnScroll =" false" >
1010
1111 <com .google.android.material.appbar.MaterialToolbar
1212 android : id =" @+id/toolbar"
1313 android : layout_width =" match_parent"
1414 android : layout_height =" match_parent"
15- android : background =" ?attr/colorPrimary "
15+ android : background =" ?attr/appBarBackgroundColor "
1616 android : theme =" ?actionBarTheme"
1717 android : touchscreenBlocksFocus =" false"
1818 app : popupTheme =" @style/ThemeOverlay.SagerNet.Toolbar.Popup"
Original file line number Diff line number Diff line change 1111 android : id =" @+id/appbar"
1212 android : layout_width =" match_parent"
1313 android : layout_height =" wrap_content"
14- android : background =" ?attr/colorPrimary " >
14+ android : background =" ?attr/appBarBackgroundColor " >
1515
1616 <com .google.android.material.appbar.CollapsingToolbarLayout
1717 android : layout_width =" match_parent"
2323 android : id =" @+id/toolbar"
2424 android : layout_width =" match_parent"
2525 android : layout_height =" ?attr/actionBarSize"
26- android : background =" ?attr/colorPrimary "
26+ android : background =" ?attr/appBarBackgroundColor "
2727 android : elevation =" 0dp"
2828 android : theme =" ?actionBarTheme"
2929 android : touchscreenBlocksFocus =" false"
Original file line number Diff line number Diff line change 1616 android : id =" @+id/group_tab"
1717 android : layout_width =" match_parent"
1818 android : layout_height =" wrap_content"
19- android : background =" ?colorPrimary "
19+ android : background =" ?attr/appBarBackgroundColor "
2020 android : elevation =" 0dp"
2121 android : visibility =" gone"
2222 app : tabIndicatorColor =" ?tabIndicatorColor"
Original file line number Diff line number Diff line change 2525 android : layout_height =" wrap_content"
2626 android : layout_gravity =" bottom"
2727 android : nextFocusUp =" @+id/fab"
28- app : backgroundTint =" ?colorPrimary "
28+ app : backgroundTint =" ?attr/appBarBackgroundColor "
2929 app : contentInsetStart =" 0dp"
3030 app : fabAlignmentMode =" center"
3131 app : fabAnchorMode =" cradle"
Original file line number Diff line number Diff line change 1616 android : id =" @+id/tools_tab"
1717 android : layout_width =" match_parent"
1818 android : layout_height =" wrap_content"
19- android : background =" ?colorPrimary "
19+ android : background =" ?attr/appBarBackgroundColor "
2020 android : elevation =" 0dp"
2121 app : tabIndicatorColor =" ?tabIndicatorColor"
2222 app : tabIndicatorFullWidth =" false"
Original file line number Diff line number Diff line change 1515 android : id =" @+id/toolbar"
1616 android : layout_width =" match_parent"
1717 android : layout_height =" ?attr/actionBarSize"
18- android : background =" ?attr/colorPrimary "
18+ android : background =" ?attr/appBarBackgroundColor "
1919 app : popupTheme =" @style/ThemeOverlay.SagerNet.Toolbar.Popup" />
2020
2121 </com .google.android.material.appbar.AppBarLayout>
Original file line number Diff line number Diff line change 105105 <item name =" android:colorBackground" >@color/dhc_background</item >
106106 <item name =" colorOnBackground" >@color/dhc_on_surface</item >
107107 <item name =" android:windowBackground" >@color/dhc_background</item >
108+ <item name =" appBarBackgroundColor" >@color/dhc_background</item >
109+ <item name =" bottomAppBarStyle" >@style/Widget.SagerNet.BottomAppBar.DarkHighContrast</item >
110+ <item name =" android:statusBarColor" >@color/dhc_background</item >
111+ <item name =" android:navigationBarColor" >@color/dhc_background</item >
112+ <item name =" actionBarTheme" >@style/ThemeOverlay.Material3.Dark.ActionBar</item >
113+ <item name =" tabTextColor" >@color/dhc_on_surface_variant</item >
114+ <item name =" tabSelectedTextColor" >@color/dhc_primary</item >
115+ <item name =" tabIndicatorColor" >@color/dhc_primary</item >
108116 <item name =" colorPrimaryContainer" >@color/dhc_container</item >
109117 <item name =" colorOnPrimaryContainer" >@color/dhc_on_surface</item >
110118 <item name =" colorSecondary" >@color/dhc_accent</item >
129137 <item name =" testFailColor" >@color/dhc_red</item >
130138 <item name =" speedTextColor" >@color/dhc_accent</item >
131139 <item name =" fabStoppedColor" >@color/dhc_on_primary</item >
140+ <item name =" fabConnectedColor" >@color/dhc_on_primary</item >
132141 <item name =" statusDetailColor" >@color/dhc_accent</item >
133142 <item name =" statusTestingColor" >@color/dhc_yellow</item >
134143 <item name =" routeProxyColor" >@color/dhc_blue</item >
Original file line number Diff line number Diff line change 3030 (red was invisible on the pink/purple FAB). Separate from the red
3131 statusStoppedColor used for the status text. -->
3232 <attr name =" fabStoppedColor" format =" color" />
33+ <!-- Connect-FAB icon tint when Connected. Default = statusConnectedColor so
34+ existing themes are unchanged; themes whose FAB background equals the
35+ connected status color (e.g. Dark High Contrast: green icon on a green
36+ FAB) override this with a contrasting color so the airplane icon stays
37+ visible. Separate from statusConnectedColor used for the status text. -->
38+ <attr name =" fabConnectedColor" format =" color" />
3339 <!-- Secondary status text (the part after "Connected," / "Success:").
3440 Default on-primary; Dracula = cyan. -->
3541 <attr name =" statusDetailColor" format =" color" />
4349 <!-- Tonal "elevated surface" color for cards (route / group); each theme
4450 variant tints toward its own primary. -->
4551 <attr name =" cardElevatedSurfaceColor" format =" color" />
52+ <!-- Background for the top app bar / toolbar and the bottom status bar.
53+ Defaults to colorPrimary (legacy single-accent chrome); full M3 dark
54+ themes (Dark High Contrast) override it with colorSurface so the chrome
55+ is the dark canvas and the accent is reserved for actions/selection. -->
56+ <attr name =" appBarBackgroundColor" format =" color" />
4657</resources >
You can’t perform that action at this time.
0 commit comments