doc/dsc/modules/ColorPicker.md
Manages configuration for the Color Picker utility, a system-wide color selection and identification tool.
The ColorPicker module configures PowerToys Color Picker, a utility that allows you to pick colors from anywhere on your screen and copy them to the clipboard in various formats. It's useful for designers, developers, and anyone working with colors.
The ColorPicker module supports the following configurable properties:
Sets the keyboard shortcut to activate the color picker.
Type: object
Properties:
win (boolean) - Windows key modifier.ctrl (boolean) - Ctrl key modifier.alt (boolean) - Alt key modifier.shift (boolean) - Shift key modifier.code (integer) - Virtual key code.key (string) - Key name.Default: Win+Shift+C
Controls whether the cursor changes when the color picker is activated.
Type: boolean
Default: true
Sets the default color format copied to the clipboard.
Type: string
Allowed values: "HEX", "RGB", "HSL", "HSV", "CMYK", "HSB",
"HSI", "HWB", "NCol"
Default: "HEX"
Controls the action when the color picker activation shortcut is pressed.
Type: integer
Allowed values:
0 - Open color picker and show editor1 - Open color picker only2 - Open editor onlyDefault: 0
Controls whether color names are displayed in the color picker.
Type: boolean
Default: false
Defines which color formats are visible in the picker interface.
Type: object with boolean properties for each format:
HEX (boolean)RGB (boolean)HSL (boolean)HSV (boolean)CMYK (boolean)HSB (boolean)HSI (boolean)HWB (boolean)NCol (boolean)Decimal (boolean)This example sets the default copied color format to RGB.
$config = @{
settings = @{
properties = @{
copiedcolorrepresentation = "RGB"
}
name = "ColorPicker"
version = "1.0"
}
} | ConvertTo-Json -Depth 10 -Compress
PowerToys.DSC.exe set --resource 'settings' --module ColorPicker --input $config
This example configures the color picker to open directly without the editor.
dsc config set --file colorpicker-activation.dsc.yaml
# colorpicker-activation.dsc.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Configure Color Picker activation
type: Microsoft.PowerToys/ColorPickerSettings
properties:
settings:
properties:
activationaction: 1
changecursor: true
copiedcolorrepresentation: HEX
name: ColorPicker
version: 1.0
This example installs PowerToys and configures Color Picker for web developers.
winget configure winget-colorpicker-webdev.yaml
# winget-colorpicker-webdev.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
winget:
processor: dscv3
resources:
- name: Install PowerToys
type: Microsoft.WinGet.DSC/WinGetPackage
properties:
id: Microsoft.PowerToys
source: winget
- name: Configure Color Picker for web development
type: Microsoft.PowerToys/ColorPickerSettings
properties:
settings:
properties:
copiedcolorrepresentation: HEX
showColorName: true
changecursor: true
VisibleColorFormats:
HEX: true
RGB: true
HSL: true
HSV: false
CMYK: false
name: ColorPicker
version: 1.0
This example enables only HEX, RGB, and HSL formats.
dsc config set --file colorpicker-formats.dsc.yaml
# colorpicker-formats.dsc.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Configure visible color formats
type: Microsoft.PowerToys/ColorPickerSettings
properties:
settings:
properties:
VisibleColorFormats:
HEX: true
RGB: true
HSL: true
HSV: false
CMYK: false
HSB: false
HSI: false
HWB: false
NCol: false
Decimal: false
name: ColorPicker
version: 1.0
This example configures Color Picker for graphic designers with CMYK support.
$config = @{
settings = @{
properties = @{
copiedcolorrepresentation = "CMYK"
showColorName = $true
VisibleColorFormats = @{
HEX = $true
RGB = $true
CMYK = $true
HSL = $true
HSV = $true
}
}
name = "ColorPicker"
version = "1.0"
}
} | ConvertTo-Json -Depth 10 -Compress
PowerToys.DSC.exe set --resource 'settings' --module ColorPicker --input $config
This example tests whether HEX is the default format.
$desired = @{
settings = @{
properties = @{
copiedcolorrepresentation = "HEX"
}
name = "ColorPicker"
version = "1.0"
}
} | ConvertTo-Json -Depth 10 -Compress
$result = PowerToys.DSC.exe test --resource 'settings' --module ColorPicker `
--input $desired | ConvertFrom-Json
if ($result._inDesiredState) {
Write-Host "HEX is the default format"
}
Configure for HTML/CSS color codes:
resources:
- name: Web developer settings
type: Microsoft.PowerToys/ColorPickerSettings
properties:
settings:
properties:
copiedcolorrepresentation: HEX
VisibleColorFormats:
HEX: true
RGB: true
HSL: true
name: ColorPicker
version: 1.0
Configure for CMYK color space:
resources:
- name: Print designer settings
type: Microsoft.PowerToys/ColorPickerSettings
properties:
settings:
properties:
copiedcolorrepresentation: CMYK
showColorName: true
name: ColorPicker
version: 1.0