{"id":30663307,"url":"https://github.com/samialtas/csharpcolorpicker","last_synced_at":"2026-04-18T11:08:49.692Z","repository":{"id":306923343,"uuid":"1027698892","full_name":"samialtas/CSharpColorPicker","owner":"samialtas","description":"A comprehensive, Excel-style color picker component for C# WinForms. Features a circular hue/saturation wheel, brightness slider, standard palette grid, and live display of RGB, CMYK, and HEX values. Includes built-in support for web-safe and print-safe (CMYK) color modes.","archived":false,"fork":false,"pushed_at":"2025-07-28T12:47:44.000Z","size":91,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T13:32:39.594Z","etag":null,"topics":["cmyk","color-palette","color-picker","color-wheel","csharp","custom-control","dotnet","excel-style","gdi-plus","hex","print-safe","rgb","ui-components","web-safe","winforms"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samialtas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-28T11:57:22.000Z","updated_at":"2025-07-28T12:47:48.000Z","dependencies_parsed_at":"2025-07-28T13:32:49.621Z","dependency_job_id":"11e25aba-a730-4590-bc2a-57852be9e13c","html_url":"https://github.com/samialtas/CSharpColorPicker","commit_stats":null,"previous_names":["samialtas/csharpcolorpicker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/samialtas/CSharpColorPicker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samialtas%2FCSharpColorPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samialtas%2FCSharpColorPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samialtas%2FCSharpColorPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samialtas%2FCSharpColorPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samialtas","download_url":"https://codeload.github.com/samialtas/CSharpColorPicker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samialtas%2FCSharpColorPicker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273010994,"owners_count":25030369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmyk","color-palette","color-picker","color-wheel","csharp","custom-control","dotnet","excel-style","gdi-plus","hex","print-safe","rgb","ui-components","web-safe","winforms"],"created_at":"2025-08-31T17:04:56.214Z","updated_at":"2026-04-18T11:08:48.611Z","avatar_url":"https://github.com/samialtas.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎨 Excel-Style Color Picker for WinForms\n\nA comprehensive, Excel-style color picker component for C# WinForms applications. This user control provides a modern and feature-rich interface for color selection, designed to be easily integrated as a drop-down from a button.\n\n## ✨ Demo\n\n \n\u003cimg src=\"Screenshot.jpg\" alt=\"PDF/A-1a Compliant Output\"\u003e\n\n## 🚀 Features\n\n-   **🌈 Circular Color Wheel**: An intuitive wheel for selecting hue and saturation.\n-   **🎚️ Brightness Slider**: A vertical slider to control the selected color's brightness (HSV Value).\n-   **▦ Standard Palette**: A pre-defined grid of theme colors, similar to Microsoft Office applications.\n-   **🔢 Live Value Display**: Instantly see the selected color's values in **HEX**, **RGB**, and **CMYK** formats.\n-   **🛡️ Safety Modes**:\n    -   **Web-Safe Mode**: Snaps all color selections to the nearest web-safe color.\n    -   **Print-Safe Mode**: Snaps all selections to their nearest CMYK-safe equivalent, ensuring better color fidelity in print.\n-   **⚠️ Safety Warnings**: Visual cues indicate if the current color is not web-safe or print-safe, with a one-click option to fix it.\n-   **👀 Original vs. New Color Preview**: Easily compare the newly selected color with the original one.\n-   **⌨️ Full Keyboard Navigation**: All elements of the control are fully accessible and navigable using the keyboard.\n-   **🧩 Easy Integration**: Simply add the `ExcelColorPopupButton` to your form. No other setup is required.\n-   **📦 Self-Contained**: The control is written entirely in C# and relies only on the standard .NET `System.Windows.Forms` and `System.Drawing` libraries. No external dependencies are needed.\n\n## 🛠️ Getting Started\n\n## 📋 Prerequisites\n\nYou need a .NET project with Windows Forms support. This component has been designed with .NET Framework 4.x or .NET 5/6/7/8 and later in mind.\n\n## ⚙️ Installation\n\n1.  Clone this repository or download the source code.\n2.  Add the C# source files (`ExcelColorPopupButton.cs`, `ExcelColorDropDownControl.cs`, etc.) to your WinForms project.\n3.  Rebuild your project.\n4.  The `ExcelColorPopupButton` control should now appear in the Visual Studio Toolbox, ready to be dragged onto your forms.\n\n## 💡 How to Use\n\nThe easiest way to use the color picker is with the `ExcelColorPopupButton` control.\n\n1.  **🖱️ Add the Button to Your Form**:\n    -   After rebuilding your project, find the `ExcelColorPopupButton` in your Visual Studio Toolbox.\n    -   Drag and drop it onto your form.\n\n2.  **⚡ Handle the `ColorChanged` Event**:\n    -   Select the button on your form and go to the Events tab in the Properties window.\n    -   Double-click the `ColorChanged` event to create a handler.\n    -   Use this event to get the newly selected color and apply it to other controls or objects in your application.\n\n```csharp\n// Example: Change a Panel's background color when a new color is selected.\nprivate void excelColorPopupButton1_ColorChanged(object sender, EventArgs e)\n{\n    // Get the selected color from the button's property\n    Color newColor = excelColorPopupButton1.SelectedColor;\n\n    // Apply it to another control\n    panelToChange.BackColor = newColor;\n\n    // You can also get the value as a string for display\n    this.Text = $\"Selected Color: {newColor}\";\n}\n\n// You can also set the initial color of the button in your Form's Load event\nprivate void Form1_Load(object sender, EventArgs e)\n{\n    excelColorPopupButton1.SelectedColor = Color.CornflowerBlue;\n}\n```\n\n## 🔍 Code Overview\n\nThe project is structured into several key classes:\n\n-   **`🔘 ExcelColorPopupButton`**: The main `Button` control that you add to your form. It handles painting the color preview and the drop-down arrow, and it manages the display of the `ExcelColorDropDown`.\n\n-   **`🔽 ExcelColorDropDown`**: A custom `ToolStripDropDown` that acts as a borderless window to host the main color picker user control.\n\n-   **`🎛️ ExcelColorDropDownControl`**: The core `UserControl` that contains all the UI elements: the circular picker, brightness slider, color grid, text boxes, and checkboxes. It manages all the internal logic for color updates and state changes.\n\n-   **`🌈 CircularColorPicker`**: A custom control that renders the HSL color wheel and handles user input (mouse and keyboard) for selecting hue and saturation.\n\n-   **`🎚️ BrightnessSlider`**: A custom control for the vertical brightness (value) slider.\n\n-   **`🔧 ColorUtils`**: A static helper class containing methods for color model conversions (RGB, HSV, HSL, CMYK) and color safety checks.\n\n-   **`📝 VerticallyCenteredTextBox`**: A small enhancement of the standard `TextBox` to vertically center its text.\n\n-   **`🖌️ DoubleBufferedPanel`**: A simple `Panel` with double-buffering enabled to prevent flicker in the color grid.\n\n## 📜 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamialtas%2Fcsharpcolorpicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamialtas%2Fcsharpcolorpicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamialtas%2Fcsharpcolorpicker/lists"}