SparkleShare.UserInterfaceHelpers.RGBAToColor C# (CSharp) Method

RGBAToColor() public static method

public static RGBAToColor ( Gdk rgba ) : Gdk.Color
rgba Gdk
return Gdk.Color
        public static Gdk.Color RGBAToColor(Gdk.RGBA rgba)
        {
            return new Gdk.Color () {
                Red   = (ushort) (rgba.Red * 65535),
                Green = (ushort) (rgba.Green * 65535),
                Blue  = (ushort)(rgba.Blue * 65535)
            };
        }

Usage Example

Esempio n. 1
0
        public UserInterface()
        {
            string gtk_version = string.Format("{0}.{1}.{2}", Global.MajorVersion, Global.MinorVersion, Global.MicroVersion);

            Logger.LogInfo("Environment", "GTK+ " + gtk_version);

            application = new Application("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None);

            application.Register(null);
            application.Activated += ApplicationActivatedDelegate;

            IconTheme.Default.AppendSearchPath(Path.Combine(UserInterface.AssetsPath, "icons"));

            var label = new Label();

            Gdk.Color color = UserInterfaceHelpers.RGBAToColor(label.StyleContext.GetColor(StateFlags.Insensitive));
            SecondaryTextColor = UserInterfaceHelpers.ColorToHex(color);

            var tree_view = new TreeView();

            color = UserInterfaceHelpers.MixColors(
                UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetColor(StateFlags.Selected)),
                UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetBackgroundColor(StateFlags.Selected)),
                0.39);

            SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex(color);
        }
All Usage Examples Of SparkleShare.UserInterfaceHelpers::RGBAToColor