https://github.com/ryanslikesocool/nativecolorscheme
System dark mode detection in Unity for macOS and iOS
https://github.com/ryanslikesocool/nativecolorscheme
ios macos unity
Last synced: 4 months ago
JSON representation
System dark mode detection in Unity for macOS and iOS
- Host: GitHub
- URL: https://github.com/ryanslikesocool/nativecolorscheme
- Owner: ryanslikesocool
- License: mit
- Created: 2020-09-01T14:14:26.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-03-09T06:55:07.000Z (over 2 years ago)
- Last Synced: 2025-05-12T19:24:16.005Z (about 1 year ago)
- Topics: ios, macos, unity
- Language: C#
- Homepage:
- Size: 218 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# NativeColorScheme
System color scheme detection in Unity for macOS and iOS.
## Requirements
### Runtime
- macOS 11+
- iOS 14+
- tvOS 14+
---
### Editor
- macOS 11+, Unity 2020.3+
## Installation (Unity Package Manager)
- Select "Add package from git URL..." from the plus menu in the package manager window.
- Paste the package's git url.
```
https://github.com/ryanslikesocool/NativeColorScheme.git
```
## Usage
### C#
```cs
using NativeColorScheme;
static class Somewhere {
static Color GetColorForColorScheme() => ColorSchemeUtil.Current switch {
ColorScheme.Light => Color.white,
ColorScheme.Dark => Color.black,
_ => Color.magenta
};
}
```
Unsupported platforms or OS versions will return `null`.
---
### Editor
Using the Unity editor on macOS, the plugin will automatically detect the system's color scheme and change the editor accordingly.\
The preference can be set to `System`, `Light`, or `Dark` from the `Window/Color Scheme` menu.