- Notifications
You must be signed in to change notification settings - Fork43
Color picker control suite for Windows Forms applications.
License
cyotek/Cyotek.Windows.Forms.ColorPicker
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
TheCyotek.Windows.Forms.ColorPickers library contains aseries of custom controls and utility classes for Windows Formsapplications that work with colours. Controls are available toallow colour selection via a HSLColorWheel, aColorGridwith many customisation options, aColorEditor for enteringcolours via RGB or HSL, and aScreenColorPicker for capturingcolours from running applications.
Color palettes can be loaded and saved in a number of differentformats, including Adobe PhotoShop Color Swatch files, JASCPalettes, Gimp Palettes and more (see Color Palettes andExternal Palette Files below).
For more information on these controls, see thearticles taggedwithcolorpicker at cyotek.com.
The easiest way of obtaining the library is viaNuGet.
Install-Package Cyotek.Windows.Forms.ColorPicker
If you don't use NuGet, pre-compiled binaries can be obtainedfrom theGitHub Releases page.
Of course, you can always grabthe source and build ityourself!
There are three primary controls (ColorGrid,ColorWheel andColorEditor), along with 5 utility controls(ScreenColorPicker,RgbaColorSlider,HueColorSlider,LightnessColorSlider andSaturationColorSlider), amanagement component (ColorEditorManager) and one dialog(ColorPickerDialog). Combined together, these provide a decentarray of tools for colour selection.
This control displays a grid of colours, and supports both aprimary palette, and a custom colour palette. Several propertiesare available for configuring the appearing of the control, andthere are behaviour options too, such as built in editing ofcolours and support for automatically adding new colours not inthe primary palette.
This control displays a radial wheel of RGB colours and allowsselection from any point in the wheel. TheShowAngleArrow,ShowCenterLines andShowSaturationRing properties can beused to display useful adornments, while theLightness andAlpha properties can be used to compose the final colour whilenot being directly editable on the wheel.
TheSecondaryColors andSecondarySelectionSize propertiesallow you to display additional colours on the wheel, forexample for showing relationships.
A bunch of controls (inheriting from a single base) that allowselection of values via a colourful bar. Similar to theTrackBar control you have a few options for specifying thedrag handle's position and bar orientation. You can alsocustomise the fill and outline colour, or replace it completelywith a custom image.
This control allows the editing of a RGB or HSL colour via astandard interface. You can also enter colours via 6 or 8character hexadecimal notation, or choose from named web andsystem colors.
Use of the alpha channel can be configured via theShowAlphaChannel andPreserveAlphaChannel properties. TheShowHex,ShowHsl andShowRgb properties can be used toshow or hide groups of editors.
Alternatively, theNubSize,NubColor andNubOutlineColorproperties can be used to customise the appearance of thesliders.
This control allows the user to pick a colour from any pixeldisplayed on the screen. The user can either trigger theoperation by clicking and dragging the control, or it can bedone programmatically via theCaptureMouse method, allowingselections to be triggered via other actions, for example a hotkey. TheZoom property can be used set the grid size of thepreview.
This form puts together the previous controls in a ready to usedialog.
Custom colours are supported via theCustomColors property,and users can also load or save external palette files intothese. You can use theShowLoad andShowSave properties toenable or disable this, and theCustomColorsLoading andCustomColorsSavingevents to override the built-in behaviourand provide your own logic.
This is a non-GUI component that you can drop onto a form, andbind to other controls in this library. When theColorproperty of one control changes, it is reflected in the otherswithout having to lift a finger. Useful if you're creatingcomposite displays from multiple controls.
TheColorGrid control hasColors andCustomColorsproperties which return aColorCollection. These twoproperties make it easier as a developer to keep separate aprimary palette whilst having the flexibility of custom colours,although it does complicate the control's internal logic a bit!The grid will automatically populate custom colours if you tryand set the control'sColor to a value not currently defined.
As well as manually populatingColorCollection instances, youcan also load in external palette files. The following paletteformats are supported:
- Adobe Color Table (*.act)
- Adobe PhotoShop Color Swatch (*.aco)
- GIMP (*.gpl)
- Deluxe Paint (*.bbm; *.lbm) [read only]
- JASC (*.pal)
- Paint.NET (*.txt)
- Raw RGB Triplets (*.pal)
With the exception of the ILBM image format, all other formatscan be exported as well as imported.
Additional palette serializers can be easily created by adding aclass which implementsIPaletteSerializer. TheColorPickerDialog (or any custom code usingPaletteSerializer static methods) will automatically detectand make available custom palettes via reflection.
All GUI components, with the exception of theScreenColorPicker include full keyboard/focus support. Manycontrols supportSmallChange andLargeChange propertieswhich influence how navigation keys are processed. Although inthe case of theColorWheel it's not really a bonus... butthat's what theColorEditor control is best suited for!
.NET Framework 3.5 or later.
Pre-built binaries are available via a signedNuGetpackage containing the following targets.
- .NET 3.5
- .NET 4.0
- .NET 4.5.2
- .NET 4.6.2
- .NET 4.7.2
- .NET 4.8
- .NET 5.0
Contributions accepted!
- Found a problem?Raise an issue
- Want to improve the code?Make a pull request
Alternatively, if you make use of this software and it saves yousome time, donations are welcome.
- XML documentation comments are incomplete
- Reading Photoshop Color Swatch (aco) files using C#
- Writing Photoshop Color Swatch (aco) files using C#
- Loading the color palette from a BBM/LBM image file using C#
- Hosting a ColorGrid control in a ToolStrip
- Inspiration (and some code!) was taken fromColor Picker withColor Wheel and Eye Dropper
- The eye dropper png graphic is from theMomentum GlossyIcons
- DawnBringer 16 color palette
- DawnBringer 32 color palette
- The Atari 800 XL color palette bySpace Monster Games
- Arne Palette v20
About
Color picker control suite for Windows Forms applications.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Uh oh!
There was an error while loading.Please reload this page.








