A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
911 B

using System;
using System.Linq;
using Avalonia.Media;
using Avalonia.Platform;
using Foundation;
using UIKit;
namespace Avalonia.iOS;
// TODO: ideally should be created per view/activity.
internal class PlatformSettings : DefaultPlatformSettings
{
private PlatformColorValues _lastColorValues;
public override PlatformColorValues GetColorValues()
{
var themeVariant = UITraitCollection.CurrentTraitCollection.UserInterfaceStyle == UIUserInterfaceStyle.Dark ?
PlatformThemeVariant.Dark :
PlatformThemeVariant.Light;
return _lastColorValues = new PlatformColorValues(themeVariant);
}
public void TraitCollectionDidChange()
{
var oldColorValues = _lastColorValues;
var colorValues = GetColorValues();
if (oldColorValues != colorValues)
{
OnColorValuesChanged(colorValues);
}
}
}