Python Color Picker
Python Color Picker adds color decorations, color picker support, and fast color conversion workflows for Python files in VS Code.
What It Supports
- Hex:
#RGB, #RGBA, #RRGGBB, #RRGGBBAA
0x hex: 0xRRGGBB, 0xRRGGBBAA
rgb() / rgba() (comma/space forms, slash alpha, percent channels)
hsl() / hsla() (deg/rad/grad/turn hue units)
- Bare tuples:
(r, g, b) and (r, g, b, a) (configurable)
Quick Start
- Open any
.py file that contains colors.
- Hover a color token to open the interactive hover palette.
- Use:
Copy to copy any generated format,
Replace to replace in-place,
- quick-fix actions (
Convert color to ...) from the lightbulb menu,
- color picker UI for direct picking,
- command palette actions for conversion/palette generation.
Tutorial: Common Workflows
- Put cursor on a color or select a color token.
- Run
Python Color Picker: Convert Selection To Format.
- Pick target format (
hex, rgba, hsl, etc.).
- Run
Python Color Picker: Set Session Format Lock.
- Choose
hex, rgba, hsla, etc.
- Replacements and presentations prioritize that lock.
- Clear with
Python Color Picker: Clear Session Format Lock.
3) Generate a palette block from one color
- Put cursor on a color.
- Run
Python Color Picker: Generate Palette From Selection.
- A palette dictionary with variants/harmony/opacity entries is inserted below the current line.
4) Rich hover exploration
Use rich mode to get:
- Base format list
- Variants (
+/- lightness steps)
- More variants
- Complementary/analogous rotations
- Opacity quick actions
- Optional contrast badges
5) Bulk convert colors
- Select one or more ranges and run
Python Color Picker: Convert Colors In Selection, or run Python Color Picker: Convert Colors In File.
- Pick target format (
hex, rgba, hsl, etc.).
- The extension converts all detected color tokens in scope and skips already-matching tokens.
Commands
Python Color Picker: Set Session Format Lock
Python Color Picker: Clear Session Format Lock
Python Color Picker: Convert Selection To Format
Python Color Picker: Convert Colors In Selection
Python Color Picker: Convert Colors In File
Python Color Picker: Generate Palette From Selection
Python Color Picker: Open Settings
Key Settings
Parsing and detection
pythonColorPicker.scanInStringsAndCommentsOnly
pythonColorPicker.detectBareTuples
pythonColorPicker.supportedFormats
pythonColorPicker.maxFileSizeKB
pythonColorPicker.preferredFormat
pythonColorPicker.defaultFormatLock
pythonColorPicker.showOnlyRelevantFormats
pythonColorPicker.hexAlphaOrder
Hover behavior and personalization
pythonColorPicker.hoverMode (rich or compact)
pythonColorPicker.showScrollCues
pythonColorPicker.variantSteps
pythonColorPicker.harmonyAngles
pythonColorPicker.opacityPresets
pythonColorPicker.showContrastBadges
| |