Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanslikesocool committed Mar 6, 2024
1 parent 5c250f7 commit 7a0a5d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
1 change: 0 additions & 1 deletion Editor/EditorThemeSwitcher.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#if UNITY_EDITOR_OSX
using UnityEditor;
using UnityEngine;

namespace NativeColorScheme {
public static class EditorThemeSwitcher {
Expand Down
45 changes: 34 additions & 11 deletions README.md
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.

0 comments on commit 7a0a5d8

Please sign in to comment.