Skip to content

CyanVoxel/ColorHex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ColorHex

A simple C# script that allows for creating UnityEngine Color32 variables via a hex code string

Getting Started

Getting ColorHex into your Unity project is as simple as dropping the ColorHex.cs file into your Assets/Scripts project folder.

Usage

In order to have access to ColorHex in your script, make sure to include using ColorHexUtility; at the top of any script that requires it.

Instead of using Color32's constructor which requires you to pass byte values, you can now use the ColorHex constructor to pass in a hex code string. Since ColorHex is designed to be interoperable with Color32, an implementation can look like this:

public Color32 tintRed500 = new ColorHex("#F14234");

Features

  • Reduces development time (and headaches) by letting you use a color code that can be copy-pasted straight from programs like Photoshop
  • Works with or without a preceding '#' character
  • Supports alpha values (ex. #FFFFFF00)
  • Allows some text editor/IDE plugins to preview your color (ex. Color Info for Visual Studio Code

About

A simple C# script that allows for creating UnityEngine Color32 variables via a hex code string

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages