Skip to content

Commit f9e4822

Browse files
committed
docs(system-color): document macOS multicolor mode behavior
1 parent b473563 commit f9e4822

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

docs/runtime/system-color.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ fun App() {
2424
// Build a dynamic color scheme from the system accent
2525
darkColorScheme(primary = accentColor)
2626
} else {
27+
// null = unsupported platform or macOS multicolor mode
2728
darkColorScheme()
2829
}
2930
) {
@@ -32,6 +33,9 @@ fun App() {
3233
}
3334
```
3435

36+
!!! note "macOS Multicolor Mode"
37+
On macOS, when the user selects **Multicolor** in System Settings → Appearance → Accent color, each app is expected to use its own default color. In this case, `systemAccentColor()` returns `null` so your app can fall back to its own brand color or a default palette.
38+
3539
### Check Support
3640

3741
Use `isSystemAccentColorSupported()` to check platform support before entering a composable context — useful for feature gating or conditional UI:
@@ -98,15 +102,15 @@ The Nucleus example app uses this exact approach — you can test it by running:
98102

99103
| Function | Returns | Description |
100104
|----------|---------|-------------|
101-
| `systemAccentColor()` | `Color?` | Composable. Returns the current system accent color, or `null` if unsupported. Recomposes on change. |
105+
| `systemAccentColor()` | `Color?` | Composable. Returns the current system accent color, or `null` if unsupported or if the OS is in multicolor mode (macOS). Recomposes on change. |
102106
| `isSystemInHighContrast()` | `Boolean` | Composable. Returns `true` if the OS is in high contrast / increased contrast mode. Recomposes on change. |
103107
| `isSystemAccentColorSupported()` | `Boolean` | Non-composable. Returns whether the current platform supports accent color detection. |
104108

105109
## Platform Detection Methods
106110

107111
| Platform | Accent Color | High Contrast | Reactive |
108112
|----------|-------------|---------------|----------|
109-
| **macOS** | `NSColor.controlAccentColor` (macOS 10.14+) | `accessibilityDisplayShouldIncreaseContrast` | Yes — `NSSystemColorsDidChangeNotification` / `NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification` |
113+
| **macOS** | `NSColor.controlAccentColor` (macOS 10.14+). Returns `null` in **multicolor mode** (detected via `AppleAccentColor` user default). | `accessibilityDisplayShouldIncreaseContrast` | Yes — `NSSystemColorsDidChangeNotification` / `NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification` |
110114
| **Windows** | `HKCU\SOFTWARE\Microsoft\Windows\DWM\AccentColor` registry key (AABBGGRR) | `SystemParametersInfoW(SPI_GETHIGHCONTRAST)` | Yes — `RegNotifyChangeKeyValue` on background thread |
111115
| **Linux** | XDG Desktop Portal `org.freedesktop.appearance` / `accent-color` — RGB tuple (0.0–1.0) | XDG Desktop Portal `org.freedesktop.appearance` / `contrast` — uint32 (1 = high) | Yes — D-Bus `SettingChanged` signal listener |
112116

@@ -142,6 +146,7 @@ When ProGuard is enabled, the native bridge classes must be preserved. The Nucle
142146
-keep class io.github.kdroidfilter.nucleus.systemcolor.mac.NativeMacSystemColorBridge {
143147
native <methods>;
144148
static void onAccentColorChanged(float, float, float);
149+
static void onAccentColorCleared();
145150
static void onContrastChanged(boolean);
146151
}
147152

0 commit comments

Comments
 (0)