Skip to content

Commit

Permalink
Add platform guard (#4737)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Jareš <me@jakubjares.com>
  • Loading branch information
dotMorten and nohwnd committed Nov 7, 2023
1 parent 29edc28 commit 6734b71
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -116,6 +116,15 @@ private static void SetColorForAction(ConsoleColor foregroundColor, Action actio
return;
}

#if NET5_0_OR_GREATER
if (OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsBrowser() || OperatingSystem.IsTvOS())
{
// Console color not supported on these platforms.
action.Invoke();
return;
}
#endif

var previousForegroundColor = Console.ForegroundColor;
try
{
Expand Down

0 comments on commit 6734b71

Please sign in to comment.