コード例 #1
0
ファイル: MacConversions.cs プロジェクト: philstopford/Eto
        public static Color ToEtoWithAppearance(this NSColor color, bool calibrated = true)
        {
            if (color == null)
            {
                return(Colors.Transparent);
            }
            if (!MacVersion.IsAtLeast(10, 9))
            {
                return(color.ToEto(calibrated));
            }

            // use the current appearance to get the proper RGB values (it can be different than when the application started).
            NSAppearance saved      = NSAppearance.CurrentAppearance;
            var          appearance = NSApplication.SharedApplication.MainWindow?.EffectiveAppearance;

            if (appearance != null)
            {
                NSAppearance.CurrentAppearance = appearance;
            }

            var result = color.ToEto(calibrated);

            NSAppearance.CurrentAppearance = saved;
            return(result);
        }