├── .gitattributes
├── .gitignore
├── ColorTools
├── App.config
├── App.xaml
├── App.xaml.cs
├── ColorControlPanel.xaml
├── ColorControlPanel.xaml.cs
├── ColorTools.csproj
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── LICENSE
├── README.md
├── TEST_ColorPanel.sln
├── TEST_ColorPanel
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── SetColorWin.xaml
├── SetColorWin.xaml.cs
├── Simple Styles.xaml
└── TEST_ColorPanel.csproj
└── screen.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Windows Store app package directory
170 | AppPackages/
171 | BundleArtifacts/
172 |
173 | # Visual Studio cache files
174 | # files ending in .cache can be ignored
175 | *.[Cc]ache
176 | # but keep track of directories ending in .cache
177 | !*.[Cc]ache/
178 |
179 | # Others
180 | ClientBin/
181 | [Ss]tyle[Cc]op.*
182 | ~$*
183 | *~
184 | *.dbmdl
185 | *.dbproj.schemaview
186 | *.pfx
187 | *.publishsettings
188 | node_modules/
189 | orleans.codegen.cs
190 |
191 | # RIA/Silverlight projects
192 | Generated_Code/
193 |
194 | # Backup & report files from converting an old project file
195 | # to a newer Visual Studio version. Backup files are not needed,
196 | # because we have git ;-)
197 | _UpgradeReport_Files/
198 | Backup*/
199 | UpgradeLog*.XML
200 | UpgradeLog*.htm
201 |
202 | # SQL Server files
203 | *.mdf
204 | *.ldf
205 |
206 | # Business Intelligence projects
207 | *.rdl.data
208 | *.bim.layout
209 | *.bim_*.settings
210 |
211 | # Microsoft Fakes
212 | FakesAssemblies/
213 |
214 | # GhostDoc plugin setting file
215 | *.GhostDoc.xml
216 |
217 | # Node.js Tools for Visual Studio
218 | .ntvs_analysis.dat
219 |
220 | # Visual Studio 6 build log
221 | *.plg
222 |
223 | # Visual Studio 6 workspace options file
224 | *.opt
225 |
226 | # Visual Studio LightSwitch build output
227 | **/*.HTMLClient/GeneratedArtifacts
228 | **/*.DesktopClient/GeneratedArtifacts
229 | **/*.DesktopClient/ModelManifest.xml
230 | **/*.Server/GeneratedArtifacts
231 | **/*.Server/ModelManifest.xml
232 | _Pvt_Extensions
233 |
234 | # LightSwitch generated files
235 | GeneratedArtifacts/
236 | ModelManifest.xml
237 |
238 | # Paket dependency manager
239 | .paket/paket.exe
240 |
241 | # FAKE - F# Make
242 | .fake/
243 |
--------------------------------------------------------------------------------
/ColorTools/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ColorTools/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ColorTools/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ColorTools
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | void AppStartup(object sender, StartupEventArgs e)
17 | {
18 | MainWindow mWin = new MainWindow();
19 |
20 | mWin.Show();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ColorTools/ColorControlPanel.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
80 |
81 |
82 |
96 |
97 |
98 |
111 |
112 |
113 |
171 |
172 |
173 |
231 |
232 |
233 |
293 |
294 |
295 |
319 |
320 |
321 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
354 |
355 |
356 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
377 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
--------------------------------------------------------------------------------
/ColorTools/ColorControlPanel.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Controls.Primitives;
11 | using System.Windows.Data;
12 | using System.Windows.Documents;
13 | using System.Windows.Input;
14 | using System.Windows.Media;
15 | using System.Windows.Media.Imaging;
16 | using System.Windows.Navigation;
17 | using System.Windows.Shapes;
18 |
19 | namespace ColorTools
20 | {
21 | ///
22 | /// Interaction logic for ColorControlPanel.xaml
23 | ///
24 | public partial class ColorControlPanel : UserControl
25 | {
26 | private bool ThumbsInitialised = false;
27 |
28 | private enum Sliders { A, R, G, B, H, SV, nil }
29 | private Sliders DrivingSlider = Sliders.nil;
30 |
31 | private Color iniColor = Colors.Black;
32 | private Color tmpColor = Colors.Black;
33 | private Color outColor = Colors.Black;
34 | public Color SelectedColor { get { return outColor; } }
35 |
36 | private double outColorH, outColorS, outColorV;
37 | private bool useHSV = false;
38 |
39 | private Color thumbRColor = Color.FromRgb(0, 0, 0);
40 | private Color thumbGColor = Color.FromRgb(0, 0, 0);
41 | private Color thumbBColor = Color.FromRgb(0, 0, 0);
42 | private Color thumbHColor = Color.FromRgb(0, 0, 0);
43 |
44 | private SolidColorBrush iniColorBrush = new SolidColorBrush();
45 | private SolidColorBrush outColorBrush = new SolidColorBrush();
46 | private SolidColorBrush thumbSVbrush = new SolidColorBrush();
47 | private SolidColorBrush thumbRbrush;
48 | private SolidColorBrush thumbGbrush;
49 | private SolidColorBrush thumbBbrush;
50 | private SolidColorBrush thumbHbrush;
51 |
52 | private LinearGradientBrush SaturationGradBrush;
53 | private LinearGradientBrush RgradBrush;
54 | private LinearGradientBrush GgardBrush;
55 | private LinearGradientBrush BgradBrush;
56 | private LinearGradientBrush AgradBrush;
57 |
58 | private void IniGradientBrushes()
59 | {
60 | SaturationGradBrush = SaturationGradient.Background as LinearGradientBrush;
61 |
62 | RgradBrush = sliderRed.Background as LinearGradientBrush;
63 | GgardBrush = sliderGreen.Background as LinearGradientBrush;
64 | BgradBrush = sliderBlue.Background as LinearGradientBrush;
65 | AgradBrush = sliderAlpha.Background as LinearGradientBrush;
66 | }
67 |
68 | private void IniThumbsBrushes()
69 | {
70 | thumbRbrush = sliderRed.Foreground as SolidColorBrush;
71 | thumbGbrush = sliderGreen.Foreground as SolidColorBrush;
72 | thumbBbrush = sliderBlue.Foreground as SolidColorBrush;
73 |
74 | thumbHbrush = sliderSpectrum.Foreground as SolidColorBrush;
75 | thumbSV.Fill = thumbSVbrush;
76 |
77 | ThumbsInitialised = true;
78 | }
79 |
80 | private void IniThumbs(object sender, RoutedEventArgs e)
81 | {
82 | RootGrid.Loaded -= IniThumbs;
83 |
84 | if (!RootGrid.IsVisible) RootGrid.LayoutUpdated += IniThumbsDeferred;
85 | else AdjustThumbs(SelectedColorBrush.Color);
86 | }
87 |
88 | private void IniThumbsDeferred(object sender, EventArgs e)
89 | {
90 | if (RootGrid.ActualHeight != 0 && RootGrid.ActualWidth != 0)
91 | {
92 | RootGrid.LayoutUpdated -= IniThumbsDeferred;
93 |
94 | AdjustThumbs(SelectedColorBrush.Color);
95 | }
96 | }
97 |
98 | // Algorithm taken from Wikipedia https://en.wikipedia.org/wiki/HSL_and_HSV
99 | public static void ConvertRgbToHsv(Color color, out double hue, out double saturation, out double value)
100 | {
101 | double r = color.R / 255.0;
102 | double g = color.G / 255.0;
103 | double b = color.B / 255.0;
104 |
105 | double chroma, min = r, max = r;
106 |
107 | if (g > max) max = g;
108 | else if (g < min) min = g;
109 |
110 | if (b > max) max = b;
111 | else if (b < min) min = b;
112 |
113 | value = max;
114 | chroma = max - min;
115 |
116 | if (value == 0) saturation = 0;
117 | else saturation = chroma / max;
118 |
119 | if (saturation == 0) hue = 0;
120 | else if (max == r) hue = (g - b) / chroma;
121 | else if (max == g) hue = 2 + (b - r) / chroma;
122 | else hue = 4 + (r - g) / chroma;
123 |
124 | hue *= 60;
125 | if (hue < 0) hue += 360;
126 | }
127 |
128 | // Algorithm taken from Wikipedia https://en.wikipedia.org/wiki/HSL_and_HSV
129 | public static Color ConvertHsvToRgb(double hue, double saturation, double value)
130 | {
131 | double chroma = value * saturation;
132 |
133 | if (hue == 360) hue = 0;
134 |
135 | double hueTag = hue / 60;
136 | double x = chroma * (1 - Math.Abs(hueTag % 2 - 1));
137 | double m = value - chroma;
138 |
139 | double R, G, B;
140 |
141 | switch ((int)hueTag)
142 | {
143 | case 0:
144 | R = chroma; G = x; B = 0;
145 | break;
146 | case 1:
147 | R = x; G = chroma; B = 0;
148 | break;
149 | case 2:
150 | R = 0; G = chroma; B = x;
151 | break;
152 | case 3:
153 | R = 0; G = x; B = chroma;
154 | break;
155 | case 4:
156 | R = x; G = 0; B = chroma;
157 | break;
158 | default:
159 | R = chroma; G = 0; B = x;
160 | break;
161 | }
162 |
163 | R += m; G += m; B += m;
164 | R *= 255; G *= 255; B *= 255;
165 |
166 | return Color.FromRgb((byte)R, (byte)G, (byte)B);
167 | }
168 |
169 | public static double GetBrightness(byte R, byte G, byte B)
170 | {
171 | // Value = Max(R,G,B)
172 | byte max = R;
173 |
174 | if (G > max) max = G;
175 | if (B > max) max = B;
176 |
177 | return max / 255.0;
178 | }
179 |
180 | public static double GetSaturation(byte R, byte G, byte B)
181 | {
182 | double r = R / 255.0;
183 | double g = G / 255.0;
184 | double b = B / 255.0;
185 |
186 | double chroma, value, saturation;
187 | double min = r, max = r;
188 |
189 | if (g > max) max = g;
190 | else if (g < min) min = g;
191 |
192 | if (b > max) max = b;
193 | else if (b < min) min = b;
194 |
195 | value = max;
196 | chroma = max - min;
197 |
198 | if (value == 0) saturation = 0;
199 | else saturation = chroma / max;
200 |
201 | return saturation;
202 | }
203 |
204 | private bool ColorCodeParser(string hexcode, out Color color)
205 | {
206 | color = Color.FromArgb(0, 0, 0, 0);
207 | bool success = false;
208 |
209 | if (!string.IsNullOrWhiteSpace(hexcode.Trim()))
210 | {
211 | if (hexcode.Substring(0, 1) == "#") hexcode = hexcode.Substring(1);
212 |
213 | if (hexcode.Length == 8)
214 | {
215 | byte numeric;
216 | string strByte;
217 |
218 | // Alpha
219 | strByte = hexcode.Substring(0, 2);
220 |
221 | if (!byte.TryParse(strByte, NumberStyles.HexNumber, null as IFormatProvider, out numeric)) return false; // >>> FAILED >>>
222 | color.A = numeric;
223 |
224 | // Red
225 | strByte = hexcode.Substring(2, 2);
226 |
227 | if (!byte.TryParse(strByte, NumberStyles.HexNumber, null as IFormatProvider, out numeric)) return false; // >>> FAILED >>>
228 | color.R = numeric;
229 |
230 | // Green
231 | strByte = hexcode.Substring(4, 2);
232 |
233 | if (!byte.TryParse(strByte, NumberStyles.HexNumber, null as IFormatProvider, out numeric)) return false; // >>> FAILED >>>
234 | color.G = numeric;
235 |
236 | // Blue
237 | strByte = hexcode.Substring(6, 2);
238 |
239 | if (!byte.TryParse(strByte, NumberStyles.HexNumber, null as IFormatProvider, out numeric)) return false; // >>> FAILED >>>
240 | color.B = numeric;
241 |
242 | success = true;
243 | }
244 | }
245 |
246 | return success;
247 | }
248 |
249 | private void InputComponent(TextBox inputBox)
250 | {
251 | string input = inputBox.Text;
252 | byte numeric;
253 |
254 | switch (inputBox.Name)
255 | {
256 | case "txtAvalue":
257 | if (byte.TryParse(input, out numeric) && outColor.A != numeric)
258 | {
259 | outColor.A = numeric;
260 | outColorBrush.Color = outColor;
261 | }
262 | else txtAvalue.Text = outColor.A.ToString();
263 |
264 | break;
265 |
266 | case "txtRvalue":
267 | if (byte.TryParse(input, out numeric) && outColor.R != numeric)
268 | {
269 | outColor.R = numeric;
270 | outColorBrush.Color = outColor;
271 | }
272 | else txtRvalue.Text = outColor.R.ToString();
273 |
274 | break;
275 |
276 | case "txtGvalue":
277 | if (byte.TryParse(input, out numeric) && outColor.G != numeric)
278 | {
279 | outColor.G = numeric;
280 | outColorBrush.Color = outColor;
281 | }
282 | else txtGvalue.Text = outColor.G.ToString();
283 |
284 | break;
285 |
286 | case "txtBvalue":
287 | if (byte.TryParse(input, out numeric) && outColor.B != numeric)
288 | {
289 | outColor.B = numeric;
290 | outColorBrush.Color = outColor;
291 | }
292 | else txtBvalue.Text = outColor.B.ToString();
293 |
294 | break;
295 |
296 | case "txtColorCode":
297 | Color buffColor;
298 |
299 | if (ColorCodeParser(input, out buffColor) && outColor != buffColor)
300 | {
301 | outColorBrush.Color = buffColor;
302 | }
303 | else txtColorCode.Text = outColor.ToString();
304 |
305 | break;
306 | }
307 | }
308 |
309 | private void AdjustThumbs(Color theColor)
310 | {
311 | // --- ARGB ---
312 | byte A = theColor.A;
313 | byte R = theColor.R;
314 | byte G = theColor.G;
315 | byte B = theColor.B;
316 |
317 | outColor = theColor;
318 | txtColorCode.Text = string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", A, R, G, B);
319 |
320 | // Alpha
321 | if (DrivingSlider != Sliders.A) sliderAlpha.Value = A;
322 | txtAvalue.Text = A.ToString();
323 |
324 | theColor.A = 0;
325 | AgradBrush.GradientStops[0].Color = theColor;
326 | theColor.A = 255;
327 | AgradBrush.GradientStops[1].Color = theColor;
328 | //theColor.A = A; the alpha will be setted after the SV thumb adjusting
329 |
330 | // Red
331 | if (DrivingSlider != Sliders.R) sliderRed.Value = R;
332 | txtRvalue.Text = R.ToString();
333 |
334 | theColor.R = 0;
335 | RgradBrush.GradientStops[0].Color = theColor;
336 | theColor.R = 255;
337 | RgradBrush.GradientStops[1].Color = theColor;
338 | theColor.R = R;
339 |
340 | thumbRColor.R = R;
341 | thumbRbrush.Color = thumbRColor;
342 |
343 | // Green
344 | if (DrivingSlider != Sliders.G) sliderGreen.Value = G;
345 | txtGvalue.Text = G.ToString();
346 |
347 | theColor.G = 0;
348 | GgardBrush.GradientStops[0].Color = theColor;
349 | theColor.G = 255;
350 | GgardBrush.GradientStops[1].Color = theColor;
351 | theColor.G = G;
352 |
353 | thumbGColor.G = G;
354 | thumbGbrush.Color = thumbGColor;
355 |
356 | // Blue
357 | if (DrivingSlider != Sliders.B) sliderBlue.Value = B;
358 | txtBvalue.Text = B.ToString();
359 |
360 | theColor.B = 0;
361 | BgradBrush.GradientStops[0].Color = theColor;
362 | theColor.B = 255;
363 | BgradBrush.GradientStops[1].Color = theColor;
364 | theColor.B = B;
365 |
366 | thumbBColor.B = B;
367 | thumbBbrush.Color = thumbBColor;
368 |
369 | // --- HSV ---
370 | ConvertRgbToHsv(theColor, out outColorH, out outColorS, out outColorV);
371 |
372 | thumbHColor = ConvertHsvToRgb(outColorH, 1, 1);
373 |
374 | // Hue
375 | thumbHbrush.Color = thumbHColor;
376 | if (DrivingSlider != Sliders.H) sliderSpectrum.Value = outColorH;
377 |
378 | // SV thumb
379 | thumbSVbrush.Color = theColor;
380 |
381 | // Saturation gradient
382 | SaturationGradBrush.GradientStops[1].Color = thumbHColor;
383 |
384 | // Saturation and value to canvas coords
385 | Canvas.SetLeft(thumbSV, outColorS * SaturationGradient.ActualWidth - 0.5 * thumbSV.ActualWidth);
386 | Canvas.SetTop(thumbSV, (1 - outColorV) * SaturationGradient.ActualHeight - 0.5 * thumbSV.ActualHeight);
387 |
388 | // RISE EVENT
389 | if (tmpColor != outColor)
390 | {
391 | ColorChanged?.Invoke(this, new ColorChangedEventArgs(iniColor, tmpColor, outColor));
392 | tmpColor = outColor;
393 | }
394 | }
395 |
396 | private void AdjustThumbs(double H, double S, double V)
397 | {
398 | // --- HSV ---
399 | thumbHColor = ConvertHsvToRgb(H, 1, 1);
400 |
401 | // Hue
402 | thumbHbrush.Color = thumbHColor;
403 | if (DrivingSlider != Sliders.H) sliderSpectrum.Value = H;
404 |
405 | // Saturation gradient
406 | SaturationGradBrush.GradientStops[1].Color = thumbHColor;
407 |
408 | // Saturation and value to canvas coords
409 | if (DrivingSlider != Sliders.SV)
410 | {
411 | Canvas.SetLeft(thumbSV, S * SaturationGradient.ActualWidth - 0.5 * thumbSV.ActualWidth);
412 | Canvas.SetTop(thumbSV, (1 - V) * SaturationGradient.ActualHeight - 0.5 * thumbSV.ActualHeight);
413 | }
414 |
415 | byte A = outColor.A;
416 | //outColor = ConvertHsvToRgb(H, S, V);
417 |
418 | // SV thumb
419 | thumbSVbrush.Color = outColor;
420 |
421 | // --- ARGB ---
422 | outColor.A = A;
423 | byte R = outColor.R;
424 | byte G = outColor.G;
425 | byte B = outColor.B;
426 |
427 | txtColorCode.Text = string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", A, R, G, B);
428 |
429 | // Alpha
430 | sliderAlpha.Value = A;
431 | txtRvalue.Text = A.ToString();
432 |
433 | outColor.A = 0;
434 | AgradBrush.GradientStops[0].Color = outColor;
435 | outColor.A = 255;
436 | AgradBrush.GradientStops[1].Color = outColor;
437 | //outColor.A = A; // the alpha will be setted after RGB adjusting
438 |
439 | // Red
440 | sliderRed.Value = R;
441 | txtRvalue.Text = R.ToString();
442 |
443 | outColor.R = 0;
444 | RgradBrush.GradientStops[0].Color = outColor;
445 | outColor.R = 255;
446 | RgradBrush.GradientStops[1].Color = outColor;
447 | outColor.R = R;
448 |
449 | thumbRColor.R = R;
450 | thumbRbrush.Color = thumbRColor;
451 |
452 | // Green
453 | sliderGreen.Value = G;
454 | txtGvalue.Text = G.ToString();
455 |
456 | outColor.G = 0;
457 | GgardBrush.GradientStops[0].Color = outColor;
458 | outColor.G = 255;
459 | GgardBrush.GradientStops[1].Color = outColor;
460 | outColor.G = G;
461 |
462 | thumbGColor.G = G;
463 | thumbGbrush.Color = thumbGColor;
464 |
465 | // Blue
466 | sliderBlue.Value = B;
467 | txtBvalue.Text = B.ToString();
468 |
469 | outColor.B = 0;
470 | BgradBrush.GradientStops[0].Color = outColor;
471 | outColor.B = 255;
472 | BgradBrush.GradientStops[1].Color = outColor;
473 | outColor.B = B;
474 |
475 | thumbBColor.B = B;
476 | thumbBbrush.Color = thumbBColor;
477 |
478 | outColor.A = A;
479 |
480 | // RISE EVENT
481 | if (tmpColor != outColor)
482 | {
483 | ColorChanged?.Invoke(this, new ColorChangedEventArgs(iniColor, tmpColor, outColor));
484 | tmpColor = outColor;
485 | }
486 | }
487 |
488 | private void preMLBdown_addSliderHandler(object sender, MouseButtonEventArgs e)
489 | {
490 | Slider sourceSlider = e.Source as Slider;
491 |
492 | if (sourceSlider != null && DrivingSlider == Sliders.nil)
493 | {
494 | switch(sourceSlider.Name)
495 | {
496 | case "sliderAlpha":
497 | sliderAlpha.ValueChanged += AlphaThumbMove;
498 | DrivingSlider = Sliders.A;
499 | break;
500 |
501 | case "sliderRed":
502 | sliderRed.ValueChanged += RedThumbMove;
503 | DrivingSlider = Sliders.R;
504 | break;
505 |
506 | case "sliderGreen":
507 | sliderGreen.ValueChanged += GreenThumbMove;
508 | DrivingSlider = Sliders.G;
509 | break;
510 |
511 | case "sliderBlue":
512 | sliderBlue.ValueChanged += BlueThumbMove;
513 | DrivingSlider = Sliders.B;
514 | break;
515 |
516 | case "sliderSpectrum":
517 | sliderSpectrum.ValueChanged += HueThumbMove;
518 | DrivingSlider = Sliders.H;
519 | break;
520 | }
521 | }
522 | }
523 |
524 | private void removeSliderHandler()
525 | {
526 | switch (DrivingSlider)
527 | {
528 | case Sliders.A:
529 | sliderAlpha.ValueChanged -= AlphaThumbMove;
530 | break;
531 |
532 | case Sliders.R:
533 | sliderRed.ValueChanged -= RedThumbMove;
534 | break;
535 |
536 | case Sliders.G:
537 | sliderGreen.ValueChanged -= GreenThumbMove;
538 | break;
539 |
540 | case Sliders.B:
541 | sliderBlue.ValueChanged -= BlueThumbMove;
542 | break;
543 |
544 | case Sliders.H:
545 | sliderSpectrum.ValueChanged -= HueThumbMove;
546 | break;
547 | }
548 |
549 | DrivingSlider = Sliders.nil;
550 | }
551 |
552 | private void preMLBup_removeSliderHandler(object sender, MouseButtonEventArgs e)
553 | {
554 | Slider sourceSlider = e.Source as Slider;
555 |
556 | if (sourceSlider != null) removeSliderHandler();
557 | }
558 |
559 | private void LostMouseCapture_removeSliderHandler(object sender, MouseEventArgs e)
560 | {
561 | Slider sourceSlider = e.Source as Slider;
562 |
563 | if (sourceSlider != null) removeSliderHandler();
564 | }
565 |
566 | private void MLBdownOverSVsquare(object sender, MouseButtonEventArgs e)
567 | {
568 | DrivingSlider = Sliders.SV;
569 |
570 | SVthumbMove(e.GetPosition(SaturationGradient));
571 |
572 | SaturationGradient.MouseLeftButtonDown -= MLBdownOverSVsquare;
573 | SaturationGradient.MouseLeftButtonUp += MLBupSVsquare;
574 |
575 | SaturationGradient.MouseMove += SVthumbMove;
576 |
577 | SaturationGradient.CaptureMouse();
578 | }
579 |
580 | private void MLBupSVsquare(object sender, MouseButtonEventArgs e)
581 | {
582 | DrivingSlider = Sliders.nil;
583 |
584 | SaturationGradient.ReleaseMouseCapture();
585 |
586 | SaturationGradient.MouseMove -= SVthumbMove;
587 |
588 | SaturationGradient.MouseLeftButtonDown += MLBdownOverSVsquare;
589 | SaturationGradient.MouseLeftButtonUp -= MLBupSVsquare;
590 | }
591 |
592 | private void SVthumbMove(Point point)
593 | {
594 | double X = point.X;
595 | double Y = point.Y;
596 |
597 | if (X < 0) X = 0;
598 | else if (X > SaturationGradient.ActualWidth) X = SaturationGradient.ActualWidth;
599 |
600 | if (Y < 0) Y = 0;
601 | else if (Y > SaturationGradient.ActualHeight) Y = SaturationGradient.ActualHeight;
602 |
603 | outColorS = (float)(X / SaturationGradient.ActualWidth);
604 | outColorV = (float)(1 - Y / SaturationGradient.ActualHeight);
605 |
606 | Canvas.SetLeft(thumbSV, X - 0.5 * thumbSV.ActualWidth);
607 | Canvas.SetTop(thumbSV, Y - 0.5 * thumbSV.ActualHeight);
608 |
609 | byte alpha = outColor.A;
610 | outColor = ConvertHsvToRgb(outColorH, outColorS, outColorV);
611 | outColor.A = alpha;
612 |
613 | if (outColorBrush.Color != outColor) // HSV values may change while RGB values remain the same
614 | {
615 | useHSV = true;
616 | outColorBrush.Color = outColor;
617 | }
618 | }
619 |
620 | private void SVthumbMove(object sender, MouseEventArgs e)
621 | {
622 | Point point = e.GetPosition(SaturationGradient);
623 | double X = point.X;
624 | double Y = point.Y;
625 |
626 | if (X < 0) X = 0;
627 | else if (X > SaturationGradient.ActualWidth) X = SaturationGradient.ActualWidth;
628 |
629 | if (Y < 0) Y = 0;
630 | else if (Y > SaturationGradient.ActualHeight) Y = SaturationGradient.ActualHeight;
631 |
632 | outColorS = (float)(X / SaturationGradient.ActualWidth);
633 | outColorV = (float)(1 - Y / SaturationGradient.ActualHeight);
634 |
635 | Canvas.SetLeft(thumbSV, X - 0.5 * thumbSV.ActualWidth);
636 | Canvas.SetTop(thumbSV, Y - 0.5 * thumbSV.ActualHeight);
637 |
638 | byte alpha = outColor.A;
639 | outColor = ConvertHsvToRgb(outColorH, outColorS, outColorV);
640 | outColor.A = alpha;
641 |
642 | if (outColorBrush.Color != outColor) // HSV values may change while RGB values remain the same
643 | {
644 | useHSV = true;
645 | outColorBrush.Color = outColor;
646 | }
647 | }
648 |
649 | private void HueThumbMove(object sender, RoutedPropertyChangedEventArgs e)
650 | {
651 | outColorH = (float)e.NewValue;
652 |
653 | byte alpha = outColor.A;
654 | outColor = ConvertHsvToRgb(outColorH, outColorS, outColorV);
655 | outColor.A = alpha;
656 |
657 | if (outColorBrush.Color != outColor) // HSV values may change while RGB values remain the same
658 | {
659 | useHSV = true;
660 | outColorBrush.Color = outColor;
661 | }
662 | else AdjustThumbs(outColorH, outColorS, outColorV);
663 | }
664 |
665 | private void RedThumbMove(object sender, RoutedPropertyChangedEventArgs e)
666 | {
667 | outColor.R = (byte)e.NewValue;
668 | outColorBrush.Color = outColor;
669 | }
670 |
671 | private void GreenThumbMove(object sender, RoutedPropertyChangedEventArgs e)
672 | {
673 | outColor.G = (byte)e.NewValue;
674 | outColorBrush.Color = outColor;
675 | }
676 |
677 | private void BlueThumbMove(object sender, RoutedPropertyChangedEventArgs e)
678 | {
679 | outColor.B = (byte)e.NewValue;
680 | outColorBrush.Color = outColor;
681 | }
682 |
683 | private void AlphaThumbMove(object sender, RoutedPropertyChangedEventArgs e)
684 | {
685 | outColor.A = (byte)e.NewValue;
686 | outColorBrush.Color = outColor;
687 | }
688 |
689 | private void LostKeyFocus_RGBApanel(object sender, RoutedEventArgs e)
690 | {
691 | TextBox inputBox = e.Source as TextBox;
692 |
693 | if (inputBox != null)
694 | {
695 | InputComponent(inputBox);
696 | e.Handled = true;
697 | }
698 | }
699 |
700 | private void KeyDown_RGBApanel(object sender, KeyEventArgs e)
701 | {
702 | if (e.Key == Key.Enter)
703 | {
704 | TextBox inputBox = e.Source as TextBox;
705 |
706 | if (inputBox != null)
707 | {
708 | InputComponent(inputBox);
709 | e.Handled = true;
710 | }
711 | }
712 | }
713 |
714 | private void RevertIniColor(object sender, MouseEventArgs e)
715 | {
716 | outColor = iniColor;
717 | outColorBrush.Color = outColor;
718 | }
719 |
720 | public class ColorChangedEventArgs : EventArgs
721 | {
722 | private Color iniColor;
723 | private Color previousColor;
724 | private Color currentColor;
725 |
726 | public Color InitialColor { get { return iniColor; } }
727 | public Color PreviousColor { get { return previousColor; } }
728 | public Color CurrentColor { get { return currentColor; } }
729 |
730 | public ColorChangedEventArgs(Color iniC, Color preC, Color curC)
731 | {
732 | iniColor = iniC;
733 | previousColor = preC;
734 | currentColor = curC;
735 | }
736 | }
737 |
738 | public event EventHandler ColorChanged;
739 |
740 | public ColorControlPanel()
741 | {
742 | InitializeComponent();
743 |
744 | IniGradientBrushes();
745 | IniThumbsBrushes();
746 |
747 | rectInitialColor.Background = iniColorBrush;
748 | rectSelectedColor.Background = outColorBrush;
749 |
750 | RootGrid.Loaded += IniThumbs;
751 |
752 | // Subscribe on events
753 | SaturationGradient.MouseLeftButtonDown += MLBdownOverSVsquare;
754 |
755 | RootGrid.PreviewMouseLeftButtonDown += preMLBdown_addSliderHandler;
756 | RootGrid.PreviewMouseLeftButtonUp += preMLBup_removeSliderHandler;
757 | RootGrid.LostMouseCapture += LostMouseCapture_removeSliderHandler;
758 |
759 | RGBAdock.LostKeyboardFocus += LostKeyFocus_RGBApanel;
760 | RGBAdock.KeyDown += KeyDown_RGBApanel;
761 |
762 | rectInitialColor.MouseLeftButtonDown += RevertIniColor;
763 | }
764 |
765 | // --------- Dependency Properties ---------
766 | public static readonly DependencyProperty TextBoxBackgroundProperty = DependencyProperty.Register("TextBoxBackground", typeof(Brush), typeof(ColorControlPanel),
767 | new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(33, 33, 33)),
768 | FrameworkPropertyMetadataOptions.AffectsRender));
769 |
770 | public Brush TextBoxBackground
771 | {
772 | get { return (Brush)GetValue(TextBoxBackgroundProperty); }
773 | set { SetValue(TextBoxBackgroundProperty, value); }
774 | } // Brush TextBoxBackground ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
775 |
776 |
777 |
778 | public static readonly DependencyProperty TextBoxBorderProperty = DependencyProperty.Register("TextBoxBorder", typeof(Brush), typeof(ColorControlPanel),
779 | new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(85, 85, 85)),
780 | FrameworkPropertyMetadataOptions.AffectsRender));
781 |
782 | public Brush TextBoxBorder
783 | {
784 | get { return (Brush)GetValue(TextBoxBorderProperty); }
785 | set { SetValue(TextBoxBorderProperty, value); }
786 | } // Brush TextBoxBorder ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
787 |
788 |
789 |
790 | public static readonly DependencyProperty TextForegroundProperty = DependencyProperty.Register("TextForeground", typeof(Brush), typeof(ColorControlPanel),
791 | new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(185, 185, 185)),
792 | FrameworkPropertyMetadataOptions.AffectsRender));
793 |
794 | public Brush TextForeground
795 | {
796 | get { return (Brush)GetValue(TextForegroundProperty); }
797 | set { SetValue(TextForegroundProperty, value); }
798 | } // Brush TextForeground ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
799 |
800 |
801 | public static readonly DependencyProperty DockAlphaVisibilityProperty = DependencyProperty.Register("DockAlphaVisibility", typeof(Visibility), typeof(ColorControlPanel),
802 | new FrameworkPropertyMetadata(Visibility.Visible, FrameworkPropertyMetadataOptions.AffectsRender));
803 |
804 | public Visibility DockAlphaVisibility
805 | {
806 | get { return (Visibility)GetValue(DockAlphaVisibilityProperty); }
807 | set { SetValue(DockAlphaVisibilityProperty, value); }
808 | } // DockAlphaVisibility ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
809 |
810 |
811 | public static readonly DependencyProperty InitialColorBrushProperty = DependencyProperty.Register("InitialColorBrush", typeof(SolidColorBrush), typeof(ColorControlPanel),
812 | new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(85, 85, 85)),
813 | new PropertyChangedCallback(IniColorChanged)));
814 |
815 | public SolidColorBrush InitialColorBrush
816 | {
817 | get { return (SolidColorBrush)GetValue(InitialColorBrushProperty); }
818 | set { SetValue(InitialColorBrushProperty, value); }
819 | }
820 |
821 | private static void IniColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
822 | {
823 | ColorControlPanel ccp = (ColorControlPanel)d;
824 |
825 | ccp.iniColor = (e.NewValue as SolidColorBrush).Color;
826 | ccp.iniColorBrush.Color = ccp.iniColor;
827 | }
828 |
829 | // SolidColorBrush InitialColor ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
830 |
831 |
832 |
833 | public static readonly DependencyProperty SelectedColorBrushProperty = DependencyProperty.Register("SelectedColorBrush", typeof(SolidColorBrush), typeof(ColorControlPanel),
834 | new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(85, 85, 85)),
835 | new PropertyChangedCallback(SelectedColorChanged)));
836 |
837 | public SolidColorBrush SelectedColorBrush
838 | {
839 | get { return (SolidColorBrush)GetValue(SelectedColorBrushProperty); }
840 | set { SetValue(SelectedColorBrushProperty, value); }
841 | }
842 |
843 | private static void SelectedColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
844 | {
845 | ColorControlPanel ccp = (ColorControlPanel)d;
846 |
847 | if (ccp.outColorBrush != e.NewValue as SolidColorBrush)
848 | {
849 | ccp.outColorBrush = e.NewValue as SolidColorBrush;
850 | ccp.rectSelectedColor.Background = ccp.outColorBrush;
851 | }
852 |
853 | if (ccp.ThumbsInitialised)
854 | {
855 | if (ccp.useHSV)
856 | {
857 | ccp.useHSV = false;
858 | ccp.AdjustThumbs(ccp.outColorH, ccp.outColorS, ccp.outColorV);
859 | }
860 | else ccp.AdjustThumbs(ccp.outColorBrush.Color);
861 | }
862 | }
863 |
864 | // SolidColorBrush InitialColor ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
865 | }
866 | }
867 |
--------------------------------------------------------------------------------
/ColorTools/ColorTools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}
8 | Library
9 | Properties
10 | ColorTools
11 | ColorTools
12 | v4.5
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 4.0
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Designer
59 | MSBuild:Compile
60 |
61 |
62 | ColorControlPanel.xaml
63 |
64 |
65 |
66 |
67 | Code
68 |
69 |
70 | True
71 | True
72 | Resources.resx
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 | ResXFileCodeGenerator
81 | Resources.Designer.cs
82 |
83 |
84 | SettingsSingleFileGenerator
85 | Settings.Designer.cs
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
100 |
--------------------------------------------------------------------------------
/ColorTools/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("ColorTools")]
11 | [assembly: AssemblyDescription("The color picker panel, implemented as the WPF UserControl")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("AlexanderZ")]
14 | [assembly: AssemblyProduct("ColorTools")]
15 | [assembly: AssemblyCopyright("Copyright © Alexander Zubov 2017")]
16 | [assembly: AssemblyTrademark("Zubetto")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.1")]
55 | [assembly: AssemblyFileVersion("1.0.0.1")]
--------------------------------------------------------------------------------
/ColorTools/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ColorTools.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ColorTools.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ColorTools/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ColorTools/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ColorTools.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ColorTools/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ColorControl
2 | The _ColorControlPanel_ class represents the color picker panel and it is derived from the WPF _UserControl_ class.
3 | The following public members and Dependency Properties (DP) of the _ColorControlPanel_ are mainly in use:
4 |
5 | - _SelectedColor_ gets a currently picked color
6 | - _ColorChanged_ event occurs when the _SelectedColor_ is changed
7 | - DP _InitialColorBrush_ gets/sets the initial color to which you can return by clicking the left rectangle
8 | - DP _SelectedColorBrush_ gets/sets the _SelectedColor_
9 | - DP _TextBoxBackground_, _TextBoxBorder_, _TextForeground_ can be used for styling
10 |
11 | Included lightweight test project represents template of usage of the _ColorControlPanel_.
12 |
13 | 
14 |
--------------------------------------------------------------------------------
/TEST_ColorPanel.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TEST_ColorPanel", "TEST_ColorPanel\TEST_ColorPanel.csproj", "{199A735C-212B-4B7A-9ABC-D04A05765908}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763} = {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorTools", "ColorTools\ColorTools.csproj", "{C8692DBA-5E7B-40FA-964A-2DDEED2D0763}"
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {199A735C-212B-4B7A-9ABC-D04A05765908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {199A735C-212B-4B7A-9ABC-D04A05765908}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {199A735C-212B-4B7A-9ABC-D04A05765908}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {199A735C-212B-4B7A-9ABC-D04A05765908}.Release|Any CPU.Build.0 = Release|Any CPU
23 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {C8692DBA-5E7B-40FA-964A-2DDEED2D0763}.Release|Any CPU.Build.0 = Release|Any CPU
27 | EndGlobalSection
28 | GlobalSection(SolutionProperties) = preSolution
29 | HideSolutionNode = FALSE
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace TEST_ColorPanel
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
22 |
37 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using ColorTools;
16 |
17 | namespace TEST_ColorPanel
18 | {
19 | ///
20 | /// Interaction logic for MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | public Color[] ButtonsColors;
25 |
26 | private ColorControlPanel colorPanel;
27 | private SetColorWin ccpWindow = new SetColorWin();
28 | private SolidColorBrush tmpBrush = new SolidColorBrush();
29 | private SolidColorBrush tmpBrush2 = new SolidColorBrush();
30 |
31 | private int BttIndex = 0;
32 |
33 | public MainWindow()
34 | {
35 | InitializeComponent();
36 |
37 | ButtonsColors = new Color[3];
38 | ButtonsColors[0] = (button0.Foreground as SolidColorBrush).Color;
39 | ButtonsColors[1] = (button1.Background as LinearGradientBrush).GradientStops[1].Color;
40 | ButtonsColors[2] = (button2.Background as SolidColorBrush).Color;
41 | }
42 |
43 | private void openColorControls()
44 | {
45 | ccpWindow = new SetColorWin();
46 | colorPanel = ccpWindow.ColorControls;
47 |
48 | ccpWindow.Show();
49 |
50 | colorPanel.ColorChanged += buttons_ColorChanged;
51 | }
52 |
53 | private void button0_Click(object sender, RoutedEventArgs e)
54 | {
55 | if (ccpWindow == null || !ccpWindow.IsVisible) openColorControls();
56 |
57 | BttIndex = 0;
58 | tmpBrush.Color = ButtonsColors[0];
59 | tmpBrush2.Color = ButtonsColors[0];
60 | colorPanel.InitialColorBrush = tmpBrush;
61 | colorPanel.SelectedColorBrush = tmpBrush2;
62 | }
63 |
64 | private void button1_Click(object sender, RoutedEventArgs e)
65 | {
66 | if (ccpWindow == null || !ccpWindow.IsVisible) openColorControls();
67 |
68 | BttIndex = 1;
69 | tmpBrush.Color = ButtonsColors[1];
70 | tmpBrush2.Color = ButtonsColors[1];
71 | colorPanel.InitialColorBrush = tmpBrush;
72 | colorPanel.SelectedColorBrush = tmpBrush2;
73 | }
74 |
75 | private void button2_Click(object sender, RoutedEventArgs e)
76 | {
77 | if (ccpWindow == null || !ccpWindow.IsVisible) openColorControls();
78 |
79 | BttIndex = 2;
80 | tmpBrush.Color = ButtonsColors[2];
81 | tmpBrush2.Color = ButtonsColors[2];
82 | colorPanel.InitialColorBrush = tmpBrush;
83 | colorPanel.SelectedColorBrush = tmpBrush2;
84 | }
85 |
86 | private void updateBttColor()
87 | {
88 | (button0.Foreground as SolidColorBrush).Color = ButtonsColors[0];
89 | (button1.Background as LinearGradientBrush).GradientStops[1].Color = ButtonsColors[1];
90 | (button2.Background as SolidColorBrush).Color = ButtonsColors[2];
91 | }
92 |
93 | private void buttons_ColorChanged(object sender, ColorControlPanel.ColorChangedEventArgs e)
94 | {
95 | ButtonsColors[BttIndex] = e.CurrentColor;
96 | updateBttColor();
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("TEST_ColorPanel")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("TEST_ColorPanel")]
15 | [assembly: AssemblyCopyright("Copyright © 2017")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TEST_ColorPanel.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TEST_ColorPanel.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TEST_ColorPanel.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/SetColorWin.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/SetColorWin.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using ColorTools;
15 |
16 | namespace TEST_ColorPanel
17 | {
18 | ///
19 | /// Interaction logic for SetColorWin.xaml
20 | ///
21 | public partial class SetColorWin : Window
22 | {
23 | public ColorControlPanel ColorControls { get { return ccpSetBox; } }
24 |
25 | public SetColorWin()
26 | {
27 | InitializeComponent();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/Simple Styles.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
86 |
87 |
88 |
128 |
129 |
140 |
141 |
152 |
153 |
154 |
196 |
197 |
198 |
240 |
241 |
242 |
273 |
274 |
275 |
292 |
293 |
294 |
309 |
310 |
311 |
312 |
377 |
378 |
381 |
404 |
405 |
406 |
438 |
439 |
440 |
441 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
497 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
575 |
576 |
627 |
628 |
629 |
653 |
654 |
657 |
674 |
675 |
676 |
702 |
703 |
704 |
720 |
721 |
722 |
743 |
744 |
745 |
746 |
747 |
748 |
863 |
864 |
865 |
877 |
878 |
881 |
882 |
915 |
916 |
917 |
942 |
943 |
944 |
966 |
967 |
970 |
1034 |
1035 |
1036 |
1051 |
1052 |
1053 |
1072 |
1073 |
1074 |
1125 |
1126 |
--------------------------------------------------------------------------------
/TEST_ColorPanel/TEST_ColorPanel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {199A735C-212B-4B7A-9ABC-D04A05765908}
8 | WinExe
9 | Properties
10 | TEST_ColorPanel
11 | TEST_ColorPanel
12 | v4.5.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 | False
40 | ..\ColorTools\bin\Release\ColorTools.dll
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 4.0
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | MSBuild:Compile
60 | Designer
61 |
62 |
63 | SetColorWin.xaml
64 |
65 |
66 | MSBuild:Compile
67 | Designer
68 |
69 |
70 | App.xaml
71 | Code
72 |
73 |
74 | MainWindow.xaml
75 | Code
76 |
77 |
78 | Designer
79 | MSBuild:Compile
80 |
81 |
82 | MSBuild:Compile
83 | Designer
84 |
85 |
86 |
87 |
88 | Code
89 |
90 |
91 | True
92 | True
93 | Resources.resx
94 |
95 |
96 | True
97 | Settings.settings
98 | True
99 |
100 |
101 | ResXFileCodeGenerator
102 | Resources.Designer.cs
103 |
104 |
105 | SettingsSingleFileGenerator
106 | Settings.Designer.cs
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
121 |
--------------------------------------------------------------------------------
/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zubetto/ColorControl/408aa4cd9d938fbde53b349dcefffe9d1066dc5f/screen.png
--------------------------------------------------------------------------------