This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 477
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
fc2294e
commit b3a71b3
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/CommunityToolkit/Xamarin.CommunityToolkit.MauiCompat/MauiColorExtensions.android.cs
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using AColor = Android.Graphics.Color; | ||
|
||
namespace Xamarin.CommunityToolkit.MauiCompat | ||
{ | ||
public static partial class MauiColorExtensions | ||
{ | ||
public static AColor ToAndroid(this Microsoft.Maui.Graphics.Color self) | ||
{ | ||
var colorToConvert = self; | ||
|
||
if (colorToConvert == null) | ||
{ | ||
colorToConvert = Microsoft.Maui.Graphics.Colors.Transparent; | ||
} | ||
|
||
return Microsoft.Maui.Controls.Compatibility.Platform.Android.ColorExtensions.ToAndroid(colorToConvert); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/CommunityToolkit/Xamarin.CommunityToolkit.MauiCompat/MauiColorExtensions.ios.cs
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using iColor = UIKit.UIColor; | ||
|
||
namespace Xamarin.CommunityToolkit.MauiCompat | ||
{ | ||
public static partial class MauiColorExtensions | ||
{ | ||
public static iColor ToUIColor(this Microsoft.Maui.Graphics.Color self) | ||
{ | ||
var colorToConvert = self; | ||
|
||
if (colorToConvert == null) | ||
{ | ||
colorToConvert = Microsoft.Maui.Graphics.Colors.Transparent; | ||
} | ||
|
||
return Microsoft.Maui.Controls.Compatibility.Platform.iOS.ColorExtensions.ToUIColor(colorToConvert); | ||
} | ||
} | ||
} |