Skip to content

ScaredCrowGames/UnityColorPicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Color Picker for Unity

A simple color picker tool for Unity.

PaletteTextureExample

Table of Contents

Installation

  1. Use the Package Manager:

Window > Package Manager > Install package from git URL...

https://github.com/scaredcrowgames/colorpicker.git?path=src
  1. Or add this to your Unity project's Packages/manifest.json:
"com.scaredcrowgames.colorpicker": "https://github.com/scaredcrowgames/colorpicker.git?path=src"
  1. Get it from Unity Asset Store

Palette Texture Generator

Access from the top menu: Tools > ColorPickerGenerator

Features:

  • Add, remove, reorder colors
  • Import colors from image
  • Save/load color presets as .json files
  • Configure texture size and column layout
  • Save and auto-setup generated texture in .png format

Manual setup:

Tip

Strongly recommend to use ready-to-use prefab from Samples (skip this section if so).

  1. Generate (see above) or import your color palette texture
  2. Create UI image and assign the texture
  3. Create child image (raycast target should be disabled, rect middle-center, size is no matter)
  4. Assign outline texture to child image
  5. Attach ColorPicker component to any object and assign palette image and outline rect in Inspector.

Samples

The package includes:

📁 Samples/ contains ColorPickerDemo.unity, palette and outline images, preset example and ready-to-use prefab

Import it from Package Manager > Samples

How to use

The ColorPicker.cs (MonoBehaviour) allows to select colors from the palette at runtime. Subscribe to ColorSelectionChanged

colorPicker.ColorSelectionChanged += color => {
    Debug.Log("Selected color: " + color);
};

Or get current selected color directly:

var currentSelectedColor = colorPicker.CurrentSelectedColor;

Note

Default color before the very first selection is white-transparent

Contact us

Tip

All discussions, requests and bug reports can be left in the corresponding Discord channel or here in Discussions

About

Color picker for Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages