Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 7 days ago
JSON representation

System dark mode detection in Unity for macOS and iOS

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.