SparkleShare.UserInterfaceHelpers.RGBAToHex C# (CSharp) Method

RGBAToHex() public static method

public static RGBAToHex ( Gdk rgba ) : string
rgba Gdk
return string
        public static string RGBAToHex(Gdk.RGBA rgba)
        {
            return ColorToHex (RGBAToColor (rgba));
        }

Usage Example

Exemplo n.º 1
0
        public void UpdateContent(string html)
        {
            string pixmaps_path = IO.Path.Combine(UserInterface.AssetsPath, "pixmaps");
            string icons_path   = IO.Path.Combine(UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status");

            html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
            html = html.Replace("<!-- $a-color -->", "#0085cf");
            html = html.Replace("<!-- $body-font-family -->", StyleContext.GetFont(StateFlags.Normal).Family);
            html = html.Replace("<!-- $body-font-size -->", (double)(StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $body-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Normal)));
            html = html.Replace("<!-- $body-background-color -->", UserInterfaceHelpers.RGBAToHex(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Normal)));
            html = html.Replace("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $day-entry-header-background-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetBackgroundColor(StateFlags.Normal)));
            html = html.Replace("<!-- $secondary-font-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive)));
            html = html.Replace("<!-- $small-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive)));
            html = html.Replace("<!-- $small-font-size -->", "90%");
            html = html.Replace("<!-- $pixmaps-path -->", pixmaps_path);
            html = html.Replace("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-added.png"));
            html = html.Replace("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-edited.png"));
            html = html.Replace("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-deleted.png"));
            html = html.Replace("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-moved.png"));

            this.spinner.Stop();
            this.scrolled_window.Remove(this.scrolled_window.Child);

            this.web_view.LoadHtml(html, "file:///");

            this.scrolled_window.Add(this.web_view);

            this.content_wrapper.Remove(this.content_wrapper.Child);
            this.content_wrapper.Add(this.scrolled_window);

            this.scrolled_window.ShowAll();
        }