diff --git a/Editor/EditorThemeSwitcher.cs b/Editor/EditorThemeSwitcher.cs index ede92e6..0e3ed2b 100644 --- a/Editor/EditorThemeSwitcher.cs +++ b/Editor/EditorThemeSwitcher.cs @@ -1,6 +1,5 @@ #if UNITY_EDITOR_OSX using UnityEditor; -using UnityEngine; namespace NativeColorScheme { public static class EditorThemeSwitcher { diff --git a/README.md b/README.md index f08284b..7d07c5d 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file