Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ryanslikesocool/nativecolorscheme
- Owner: ryanslikesocool
- License: mit
- Created: 2020-09-01T14:14:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-09T06:55:07.000Z (8 months ago)
- Last Synced: 2024-04-18T14:02:22.985Z (7 months ago)
- Topics: ios, macos, unity
- Language: C#
- Homepage:
- Size: 218 KB
- Stars: 7
- Watchers: 2
- 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.