linux ui: Move text colors to more accessible SparkleUI class
This commit is contained in:
parent
14a1362ba8
commit
36db11b14a
|
@ -160,7 +160,7 @@ namespace SparkleShare {
|
|||
foreach (SparklePlugin plugin in Controller.Plugins) {
|
||||
store.AppendValues ("", new Gdk.Pixbuf (plugin.ImagePath),
|
||||
"<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
|
||||
"<span fgcolor=\"" + SecondaryTextColor + "\">" + plugin.Description + "</span>" +
|
||||
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + plugin.Description + "</span>" +
|
||||
"</span>", plugin);
|
||||
}
|
||||
|
||||
|
@ -183,14 +183,14 @@ namespace SparkleShare {
|
|||
Xalign = 0,
|
||||
UseMarkup = true,
|
||||
Markup = "<span size=\"small\" fgcolor=\"" +
|
||||
SecondaryTextColor + "\">" + Controller.SelectedPlugin.AddressExample + "</span>"
|
||||
Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPlugin.AddressExample + "</span>"
|
||||
};
|
||||
|
||||
Label path_example = new Label () {
|
||||
Xalign = 0,
|
||||
UseMarkup = true,
|
||||
Markup = "<span size=\"small\" fgcolor=\"" +
|
||||
SecondaryTextColor + "\">" + Controller.SelectedPlugin.PathExample + "</span>"
|
||||
Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPlugin.PathExample + "</span>"
|
||||
};
|
||||
|
||||
|
||||
|
@ -280,7 +280,7 @@ namespace SparkleShare {
|
|||
address_entry.Text = text;
|
||||
address_entry.Sensitive = (state == FieldState.Enabled);
|
||||
address_example.Markup = "<span size=\"small\" fgcolor=\"" +
|
||||
SecondaryTextColor + "\">" + example_text + "</span>";
|
||||
Program.UI.SecondaryTextColor + "\">" + example_text + "</span>";
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -291,7 +291,7 @@ namespace SparkleShare {
|
|||
path_entry.Text = text;
|
||||
path_entry.Sensitive = (state == FieldState.Enabled);
|
||||
path_example.Markup = "<span size=\"small\" fgcolor=\""
|
||||
+ SecondaryTextColor + "\">" + example_text + "</span>";
|
||||
+ Program.UI.SecondaryTextColor + "\">" + example_text + "</span>";
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -704,9 +704,9 @@ namespace SparkleShare {
|
|||
TreeSelection selection = (column.TreeView as TreeView).Selection;
|
||||
|
||||
if (selection.IterIsSelected (iter))
|
||||
markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected);
|
||||
markup = markup.Replace (Program.UI.SecondaryTextColor, Program.UI.SecondaryTextColorSelected);
|
||||
else
|
||||
markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor);
|
||||
markup = markup.Replace (Program.UI.SecondaryTextColorSelected, Program.UI.SecondaryTextColor);
|
||||
|
||||
(cell as CellRendererText).Markup = markup;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,6 @@ namespace SparkleShare {
|
|||
public string Header;
|
||||
public string Description;
|
||||
|
||||
public readonly string SecondaryTextColor;
|
||||
public readonly string SecondaryTextColorSelected;
|
||||
|
||||
|
||||
public SparkleSetupWindow () : base ("SparkleShare Setup")
|
||||
{
|
||||
|
@ -48,16 +45,6 @@ namespace SparkleShare {
|
|||
|
||||
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
|
||||
|
||||
Gdk.Color color = SparkleUIHelpers.RGBAToColor (StyleContext.GetColor (StateFlags.Insensitive));
|
||||
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
|
||||
|
||||
color = MixColors (
|
||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
|
||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
|
||||
0.39);
|
||||
|
||||
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
|
||||
|
||||
HBox layout_horizontal = new HBox (false, 0);
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
@ -164,18 +151,5 @@ namespace SparkleShare {
|
|||
Present ();
|
||||
base.ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio)
|
||||
{
|
||||
return new Gdk.Color (
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
|
||||
second_color.Red * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
|
||||
second_color.Green * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
|
||||
second_color.Blue * ratio))) / 65535)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,10 @@ namespace SparkleShare {
|
|||
public SparkleBubbles Bubbles;
|
||||
public SparkleSetup Setup;
|
||||
public SparkleAbout About;
|
||||
public SparkleNote Note;
|
||||
|
||||
public readonly string SecondaryTextColor;
|
||||
public readonly string SecondaryTextColorSelected;
|
||||
|
||||
private Gtk.Application application;
|
||||
|
||||
|
@ -42,6 +46,16 @@ namespace SparkleShare {
|
|||
|
||||
this.application.Register (null);
|
||||
this.application.Activated += ApplicationActivatedDelegate;
|
||||
|
||||
Gdk.Color color = SparkleUIHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
|
||||
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
|
||||
|
||||
color = SparkleUIHelpers.MixColors (
|
||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
|
||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
|
||||
0.39);
|
||||
|
||||
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,6 +86,7 @@ namespace SparkleShare {
|
|||
About = new SparkleAbout ();
|
||||
Bubbles = new SparkleBubbles ();
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
Note = new SparkleNote ();
|
||||
|
||||
Setup.Application = this.application;
|
||||
EventLog.Application = this.application;
|
||||
|
|
|
@ -75,5 +75,19 @@ namespace SparkleShare {
|
|||
{
|
||||
return ColorToHex (RGBAToColor (rgba));
|
||||
}
|
||||
|
||||
|
||||
public static Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio)
|
||||
{
|
||||
return new Gdk.Color (
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
|
||||
second_color.Red * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
|
||||
second_color.Green * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
|
||||
second_color.Blue * ratio))) / 65535)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue