1 //
2 // Styles.cs
3 //
4 // Author:
5 //       Lluis Sanchez <lluis@xamarin.com>
6 //
7 // Copyright (c) 2012 Xamarin Inc
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26 using System;
27 using MonoDevelop.Components;
28 
29 namespace Pinta.Docking
30 {
31 	public static class Styles
32 	{
33 		public static readonly Cairo.Color BaseBackgroundColor = new Cairo.Color (1, 1, 1);
34 		public static readonly Cairo.Color BaseForegroundColor = new Cairo.Color (0, 0, 0);
35 
36 		// General
37 
38 		public static readonly Gdk.Color ThinSplitterColor = new Gdk.Color (166, 166, 166);
39 
40 		// Document tab bar
41 
42 
43 		public static readonly Cairo.Color TabBarBackgroundColor = CairoExtensions.ParseColor ("c2c2c2");
44 		public static readonly Cairo.Color TabBarActiveTextColor = new Cairo.Color (0, 0, 0);
45 
46 		public static readonly Cairo.Color TabBarActiveGradientStartColor = Shift (TabBarBackgroundColor, 0.92);
47 		public static readonly Cairo.Color TabBarActiveGradientEndColor = TabBarBackgroundColor;
48 		public static readonly Cairo.Color TabBarGradientStartColor = Shift (TabBarBackgroundColor, 1.02);
49 		public static readonly Cairo.Color TabBarGradientEndColor = TabBarBackgroundColor;
50 		public static readonly Cairo.Color TabBarGradientShadowColor = Shift (TabBarBackgroundColor, 0.8);
51 		public static readonly Cairo.Color TabBarHoverActiveTextColor = TabBarActiveTextColor;
52 		public static readonly Cairo.Color TabBarInactiveTextColor = Blend (new Cairo.Color (0, 0, 0), TabBarGradientStartColor, 0.4);
53 		public static readonly Cairo.Color TabBarHoverInactiveTextColor = new Cairo.Color (0, 0, 0);
54 
55 		public static readonly Cairo.Color BreadcrumbGradientStartColor = CairoExtensions.ParseColor ("FFFFFF");
56 		public static readonly Cairo.Color BreadcrumbBackgroundColor = Shift (BreadcrumbGradientStartColor, .95);
57 		public static readonly Cairo.Color BreadcrumbGradientEndColor = Shift (BreadcrumbGradientStartColor, 0.9);
58 		public static readonly Cairo.Color BreadcrumbBorderColor = Shift (BreadcrumbBackgroundColor, 0.6);
59 		public static readonly Cairo.Color BreadcrumbInnerBorderColor = WithAlpha (BaseBackgroundColor, 0.1d);
60 		public static readonly Gdk.Color BreadcrumbTextColor = Shift (BaseForegroundColor, 0.8).ToGdkColor ();
61 		public static readonly Cairo.Color BreadcrumbButtonBorderColor = Shift (BaseBackgroundColor, 0.8);
62 		public static readonly Cairo.Color BreadcrumbButtonFillColor = WithAlpha (BaseBackgroundColor, 0.1d);
63 		public static readonly Cairo.Color BreadcrumbBottomBorderColor = Shift (BreadcrumbBackgroundColor, 0.7d);
64 		public static readonly bool BreadcrumbInvertedIcons = false;
65 		public static readonly bool BreadcrumbGreyscaleIcons = false;
66 
67 		// Dock pads
68 
69 		public static readonly Cairo.Color DockTabBarGradientTop = new Cairo.Color (248d / 255d, 248d / 255d, 248d / 255d);
70 		public static readonly Cairo.Color DockTabBarGradientStart = new Cairo.Color (242d / 255d, 242d / 255d, 242d / 255d);
71 		public static readonly Cairo.Color DockTabBarGradientEnd = new Cairo.Color (230d / 255d, 230d / 255d, 230d / 255d);
72 		public static readonly Cairo.Color DockTabBarShadowGradientStart = new Cairo.Color (154d / 255d, 154d / 255d, 154d / 255d, 1);
73 		public static readonly Cairo.Color DockTabBarShadowGradientEnd = new Cairo.Color (154d / 255d, 154d / 255d, 154d / 255d, 0);
74 
75 		public static readonly Gdk.Color PadBackground = new Gdk.Color (240, 240, 240);
76 		public static readonly Gdk.Color InactivePadBackground = ReduceLight (PadBackground, 0.9);
77 		public static readonly Gdk.Color PadLabelColor = new Gdk.Color (92, 99, 102);
78 		public static readonly Gdk.Color DockFrameBackground = new Gdk.Color (157, 162, 166);
79 		public static readonly Gdk.Color DockSeparatorColor = ThinSplitterColor;
80 
81 		public static readonly Gdk.Color BrowserPadBackground = new Gdk.Color (225, 228, 232);
82 		public static readonly Gdk.Color InactiveBrowserPadBackground = new Gdk.Color (240, 240, 240);
83 
84 		public static readonly Cairo.Color DockBarBackground1 = PadBackground.ToCairoColor ();
85 		public static readonly Cairo.Color DockBarBackground2 = Shift (PadBackground.ToCairoColor (), 0.95);
86 		public static readonly Cairo.Color DockBarSeparatorColorDark = new Cairo.Color (0, 0, 0, 0.2);
87 		public static readonly Cairo.Color DockBarSeparatorColorLight = new Cairo.Color (1, 1, 1, 0.3);
88 
89 		public static readonly Cairo.Color DockBarPrelightColor = CairoExtensions.ParseColor ("ffffff");
90 
91 		// Status area
92 
93 		public static readonly Cairo.Color WidgetBorderColor = CairoExtensions.ParseColor ("8c8c8c");
94 
95 		public static readonly Cairo.Color StatusBarBorderColor = CairoExtensions.ParseColor ("919191");
96 
97 		public static readonly Cairo.Color StatusBarFill1Color = CairoExtensions.ParseColor ("f5fafc");
98 		public static readonly Cairo.Color StatusBarFill2Color = CairoExtensions.ParseColor ("e9f1f3");
99 		public static readonly Cairo.Color StatusBarFill3Color = CairoExtensions.ParseColor ("d8e7ea");
100 		public static readonly Cairo.Color StatusBarFill4Color = CairoExtensions.ParseColor ("d1e3e7");
101 
102 		public static readonly Cairo.Color StatusBarErrorColor = CairoExtensions.ParseColor ("FF6363");
103 
104 		public static readonly Cairo.Color StatusBarInnerColor = new Cairo.Color (0,0,0, 0.08);
105 		public static readonly Cairo.Color StatusBarShadowColor1 = new Cairo.Color (0,0,0, 0.06);
106 		public static readonly Cairo.Color StatusBarShadowColor2 = new Cairo.Color (0,0,0, 0.02);
107 		public static readonly Cairo.Color StatusBarTextColor = CairoExtensions.ParseColor ("555555");
108 		public static readonly Cairo.Color StatusBarProgressBackgroundColor = new Cairo.Color (0, 0, 0, 0.1);
109 		public static readonly Cairo.Color StatusBarProgressOutlineColor = new Cairo.Color (0, 0, 0, 0.1);
110 
111 		public static readonly Pango.FontDescription StatusFont = Pango.FontDescription.FromString ("Normal");
112 
113 		public static int StatusFontPixelHeight { get { return (int)(11 * PixelScale); } }
114 		public static int ProgressBarHeight { get { return (int)(18 * PixelScale); } }
115 		public static int ProgressBarInnerPadding { get { return (int)(4 * PixelScale); } }
116 		public static int ProgressBarOuterPadding { get { return (int)(4 * PixelScale); } }
117 
118 		static readonly double PixelScale = GtkWorkarounds.GetPixelScale ();
119 
120 		// Toolbar
121 
122 		public static readonly Cairo.Color ToolbarBottomBorderColor = new Cairo.Color (0.5, 0.5, 0.5);
123 		public static readonly Cairo.Color ToolbarBottomGlowColor = new Cairo.Color (1, 1, 1, 0.2);
124 
125 		// Code Completion
126 
127 		public static readonly int TooltipInfoSpacing = 1;
128 
129 		// Popover Windows
130 
131 		public static class PopoverWindow
132 		{
133 			public static readonly int PagerTriangleSize = 6;
134 			public static readonly int PagerHeight = 16;
135 
136 			public static readonly Cairo.Color DefaultBackgroundColor = CairoExtensions.ParseColor ("fff3cf");
137 			public static readonly Cairo.Color ErrorBackgroundColor = CairoExtensions.ParseColor ("E27267");
138 			public static readonly Cairo.Color WarningBackgroundColor = CairoExtensions.ParseColor ("efd46c");
139 			public static readonly Cairo.Color InformationBackgroundColor = CairoExtensions.ParseColor ("709DC9");
140 
141 			public static readonly Cairo.Color DefaultBorderColor = CairoExtensions.ParseColor ("ffeeba");
142 			public static readonly Cairo.Color ErrorBorderColor = CairoExtensions.ParseColor ("c97968");
143 			public static readonly Cairo.Color WarningBorderColor = CairoExtensions.ParseColor ("e8c12c");
144 			public static readonly Cairo.Color InformationBorderColor = CairoExtensions.ParseColor ("6688bc");
145 
146 			public static readonly Cairo.Color DefaultTextColor = CairoExtensions.ParseColor ("665a36");
147 			public static readonly Cairo.Color ErrorTextColor = CairoExtensions.ParseColor ("ffffff");
148 			public static readonly Cairo.Color WarningTextColor = CairoExtensions.ParseColor ("563b00");
149 			public static readonly Cairo.Color InformationTextColor = CairoExtensions.ParseColor ("ffffff");
150 
151 			public static class ParamaterWindows
152 			{
153 				public static readonly Cairo.Color GradientStartColor = CairoExtensions.ParseColor ("fffee6");
154 				public static readonly Cairo.Color GradientEndColor = CairoExtensions.ParseColor ("fffcd1");
155 			}
156 		}
157 
158 		// Helper methods
159 
Shift(Cairo.Color color, double factor)160 		internal static Cairo.Color Shift (Cairo.Color color, double factor)
161 		{
162 			return new Cairo.Color (color.R * factor, color.G * factor, color.B * factor, color.A);
163 		}
164 
WithAlpha(Cairo.Color c, double alpha)165 		internal static Cairo.Color WithAlpha (Cairo.Color c, double alpha)
166 		{
167 			return new Cairo.Color (c.R, c.G, c.B, alpha);
168 		}
169 
Blend(Cairo.Color color, Cairo.Color targetColor, double factor)170 		internal static Cairo.Color Blend (Cairo.Color color, Cairo.Color targetColor, double factor)
171 		{
172 			return new Cairo.Color (color.R + ((targetColor.R - color.R) * factor),
173 			                        color.G + ((targetColor.G - color.G) * factor),
174 			                        color.B + ((targetColor.B - color.B) * factor),
175 			                        color.A
176 			                        );
177 		}
178 
MidColor(double factor)179 		internal static Cairo.Color MidColor (double factor)
180 		{
181 			return Blend (BaseBackgroundColor, BaseForegroundColor, factor);
182 		}
183 
ReduceLight(Cairo.Color color, double factor)184 		internal static Cairo.Color ReduceLight (Cairo.Color color, double factor)
185 		{
186 			var c = color.ToXwtColor ();
187 			c.Light *= factor;
188 			return c.ToCairoColor ();
189 		}
190 
IncreaseLight(Cairo.Color color, double factor)191 		internal static Cairo.Color IncreaseLight (Cairo.Color color, double factor)
192 		{
193 			var c = color.ToXwtColor ();
194 			c.Light += (1 - c.Light) * factor;
195 			return c.ToCairoColor ();
196 		}
197 
ReduceLight(Gdk.Color color, double factor)198 		internal static Gdk.Color ReduceLight (Gdk.Color color, double factor)
199 		{
200 			return ReduceLight (color.ToCairoColor (), factor).ToGdkColor ();
201 		}
202 
IncreaseLight(Gdk.Color color, double factor)203 		internal static Gdk.Color IncreaseLight (Gdk.Color color, double factor)
204 		{
205 			return IncreaseLight (color.ToCairoColor (), factor).ToGdkColor ();
206 		}
207 	}
208 }
209 
210