|
1 | 1 | # Ph0rd.ColorSampler |
2 | 2 |
|
3 | | -`Ph0rd.ColorSampler` is a performant Windows desktop eyedropper for .NET apps (WinUI 3, WPF, WinForms). |
| 3 | +`Ph0rd.ColorSampler` is a performant Windows desktop eyedropper for .NET apps (WinUI 3, WPF, WinForms, console). |
4 | 4 | It shows a click-through crosshair, a zoomed pixel preview, and raises simple events as the sampled color changes, is confirmed, or is cancelled. |
5 | 5 |
|
6 | 6 | It is the color sampling component used by [Instant Syntax Styler](https://www.ph0rd.com/instant-syntax-styler/), the Visual Studio 2026 extension for changing syntax |
@@ -80,22 +80,28 @@ Supported target frameworks: |
80 | 80 |
|
81 | 81 | Expected limitations: |
82 | 82 |
|
83 | | -- It is not for web, service, console-only, macOS, or Linux apps. |
| 83 | +- It is not for web, service, macOS, or Linux apps. |
| 84 | +- Console apps are supported when they run in an interactive Windows desktop session. |
84 | 85 | - Security tools, RDP sessions, UAC prompts, lock screens, or secure desktops may block or interrupt sampling. |
85 | 86 | - The sampler captures normal desktop pixels. It is not designed to bypass protected content. |
86 | 87 |
|
87 | 88 | ## Samples |
88 | 89 |
|
89 | | -The repository includes three small samples: |
| 90 | +The repository includes four small samples: |
90 | 91 |
|
91 | 92 | ```powershell |
| 93 | +dotnet run --project samples/ColorSampler.ConsoleSample/ColorSampler.ConsoleSample.csproj |
92 | 94 | dotnet run --project samples/ColorSampler.WpfSample/ColorSampler.WpfSample.csproj |
93 | 95 | dotnet run --project samples/ColorSampler.WinFormsSample/ColorSampler.WinFormsSample.csproj |
94 | 96 | dotnet run --project samples/ColorSampler.WinUISample/ColorSampler.WinUISample.csproj |
95 | 97 | ``` |
96 | 98 |
|
97 | | -Each sample shows the same pattern: create a `Sampler`, subscribe to `ColorChanged`, `Confirmed`, and `Cancelled`, |
98 | | -marshal back to the UI thread, and dispose the sampler when finished. |
| 99 | +The console sample is intentionally script-friendly: it launches sampling immediately, writes the confirmed |
| 100 | +color to stdout as `#RRGGBB`, returns exit code `0` when a color is selected, returns `1` when cancelled, |
| 101 | +and returns `2` for unexpected sampler errors. |
| 102 | + |
| 103 | +The GUI samples show the same UI pattern: create a `Sampler`, subscribe to `ColorChanged`, `Confirmed`, |
| 104 | +and `Cancelled`, marshal back to the UI thread, and dispose the sampler when finished. |
99 | 105 |
|
100 | 106 | ## Build |
101 | 107 |
|
|
0 commit comments