Example #1
0
        public static void EnableDisableNightMode()
        {
            var nightmode = NSUserDefaults.StandardUserDefaults.BoolForKey("nightMode");

            nightmode = !nightmode;
            if (OnEnableNightMode != null)
            {
                if (nightmode)
                {
                    BackgroundColor     = UIColor.Black;
                    CellBackgroundColor = UIColor.Black;
                    ForegroundColor     = UIColor.Green;
                    BorderColor         = UIColor.Green.CGColor;
                }
                else
                {
                    BackgroundColor     = UIColor.White;
                    CellBackgroundColor = UIColor.FromRGB(238, 238, 238);
                    ForegroundColor     = UIColor.Black;
                    BorderColor         = UIColor.LightGray.CGColor;
                }

                OnEnableNightMode(nightmode);
                NSUserDefaults.StandardUserDefaults.SetBool(nightmode, "nightMode");
            }
        }
 //Change the color of the
 public override void AwakeFromNib()
 {
     base.AwakeFromNib();
     if (this.View.Layer != null)
     {
         var color = new CoreGraphics.CGColor(red: 105 / 255f, green: 105 / 255f, blue: 105 / 255f);
         this.View.Layer.BackgroundColor = color;
     }
 }
Example #3
0
        static SafariViewControllerConfiguration()
        {
            color_xamarin_blue = new CoreGraphics.CGColor(0x34, 0x98, 0xdb);
            SafariViewControllerUnsupportedMessage =
                "SafariViewController is not supported in iOS < 9"
                + System.Environment.NewLine +
                "close CustomTabs by navigating back to the app."
            ;

            //SFSafariViewController

            return;
        }
Example #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            nfloat tamaño = (imagenPerfil.Frame.Size.Width) / 2;

            imagenPerfil.Layer.CornerRadius = tamaño;
            imagenPerfil.ClipsToBounds      = true;
            imagenPerfil.Layer.BorderWidth  = 3.0f;
            CoreGraphics.CGColor color = new CoreGraphics.CGColor(0.2f, 0.3f, 1.0f, 1.0f);
            imagenPerfil.Layer.BorderColor = color;
            imagenPerfil.Image             = UIImage.FromBundle("Imagenes/Ivan.jpg");
        }
Example #5
0
        /// <summary>
        /// Creates a hex color string from a CGColor
        /// </summary>
        /// <param name="cgColor">The CGColor to stringify</param>
        /// <returns>Corresponding color string, in the hex form "#AARRGGBB"</returns>
        public static string ToHexColor(CGColor cgColor)
        {
            var builder = new StringBuilder("#");

            // CGColor components are RGBA, but we want ARGB
            var argb = cgColor.Components.Skip(3).Concat(cgColor.Components.Take(3)).ToList();

            foreach (var component in argb)
            {
                builder.AppendFormat("{0:X2}", (int)(component * 255));
            }

            return(builder.ToString());
        }
Example #6
0
        /// <summary>
        /// Creates a hex color string from a CGColor
        /// </summary>
        /// <param name="cgColor">The CGColor to stringify</param>
        /// <returns>Corresponding color string, in the hex form "#AARRGGBB"</returns>
        public static string ToHexColor(CGColor cgColor)
        {
            var builder = new StringBuilder("#");

            // CGColor components are RGBA, but we want ARGB
            var argb = cgColor.Components.Skip(3).Concat(cgColor.Components.Take(3)).ToList();

            foreach (var component in argb)
            {
                builder.AppendFormat("{0:X2}", (int)(component * 255));
            }

            return builder.ToString();
        }
Example #7
0
        public static uint UIColorToInt(CoreGraphics.CGColor color)
        {
            nfloat colorR = 0, colorG = 0, colorB = 0, colorA = 0;

            nint numComponents = color.NumberOfComponents;

            if (numComponents == 4)
            {
                colorR = color.Components[0];
                colorG = color.Components[1];
                colorB = color.Components[2];
                colorA = color.Components[3];
            }

            return((uint)(colorR * 255.0f) << 24 | (uint)(colorG * 255.0f) << 16 | (uint)(colorB * 255.0f) << 8 | (uint)(colorA * 255.0f));
        }
Example #8
0
        public static void SetColorsOnStartup()
        {
            var nightmode = NSUserDefaults.StandardUserDefaults.BoolForKey("nightMode");

            if (nightmode)
            {
                BackgroundColor     = UIColor.Black;
                CellBackgroundColor = UIColor.Black;
                ForegroundColor     = UIColor.Green;
                CoreGraphics.CGColor BorderColor = UIColor.Green.CGColor;
            }
            else
            {
                BackgroundColor     = UIColor.White;
                CellBackgroundColor = UIColor.FromRGB(238, 238, 238);
                ForegroundColor     = UIColor.Black;
                CoreGraphics.CGColor BorderColor = UIColor.LightGray.CGColor;
            }
        }
Example #9
0
            protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item)
            {
                var cell = tableView.DequeueReusableCell(cellReuseIdentifier, indexPath);

                cell.BackgroundColor = UIColor.White;
                if (!originalLayerSet)
                {
                    cornerRadius     = cell.Layer.CornerRadius;
                    borderWidth      = cell.Layer.BorderWidth;
                    borderColor      = cell.Layer.BorderColor;
                    bgColor          = cell.BackgroundColor;
                    originalLayerSet = true;
                }
                else
                {
                    restoreCell(cell);
                }
                cell.TextLabel.Text = item.ToString();

                return(cell);
            }
Example #10
0
 public static Xwt.Drawing.Color ToXwtColor(this CoreGraphics.CGColor col)
 {
     throw new NotImplementedException();
 }