SparkleShare.UserInterfaceHelpers.ColorToHex C# (CSharp) Method

ColorToHex() public static method

public static ColorToHex ( Gdk color ) : string
color Gdk
return string
        public static string ColorToHex(Gdk.Color color)
        {
            return string.Format ("#{0:X2}{1:X2}{2:X2}",
                (int) Math.Truncate (color.Red   / 256.00),
                (int) Math.Truncate (color.Green / 256.00),
                (int) Math.Truncate (color.Blue  / 256.00));
        }

Usage Example

Exemplo 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::ColorToHex