-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c250f7
commit 7a0a5d8
Showing
2 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
# NativeColorScheme | ||
System color scheme detection in Unity for macOS and iOS (runtime) and macOS (editor). | ||
System color scheme detection in Unity for macOS and iOS. | ||
|
||
## Requirements | ||
Color Scheme requires macOS 11 or later, or iOS 14 or later | ||
### Runtime | ||
- macOS 11+ | ||
- iOS 14+ | ||
- tvOS 14+ | ||
|
||
**Recommended Installation** (Unity Package Manager) | ||
- "Add package from git URL..." | ||
- `https://github.com/ryanslikesocool/NativeColorScheme.git` | ||
--- | ||
|
||
**Alternate Installation** | ||
- Get the latest [release](https://github.com/ryanslikesocool/ColorScheme/releases) | ||
- Open with the desired Unity project | ||
- Import into the Plugins folder | ||
### 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 | ||
Get the value from `ColorScheme.ColorSchemeUtil.CurrentColorScheme` from anywhere in your code and use accordingly.\ | ||
Unsupported platforms/OS versions will return `ColorScheme.Unknown`. | ||
### 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. |