https://github.com/CyanVoxel/ColorHex
A simple C# script that allows for creating UnityEngine Color32 variables via a hex code string
https://github.com/CyanVoxel/ColorHex
color hex-codes hex-color unity unity-scripts unity3d
Last synced: 25 days ago
JSON representation
A simple C# script that allows for creating UnityEngine Color32 variables via a hex code string
- Host: GitHub
- URL: https://github.com/CyanVoxel/ColorHex
- Owner: CyanVoxel
- License: mit
- Created: 2019-09-09T06:23:11.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T16:36:58.000Z (over 5 years ago)
- Last Synced: 2025-04-14T18:48:48.827Z (about 1 month ago)
- Topics: color, hex-codes, hex-color, unity, unity-scripts, unity3d
- Language: C#
- Homepage:
- Size: 53.7 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](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:
```cs
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](https://github.com/mattbierner/vscode-color-info) for [Visual Studio Code](https://code.visualstudio.com/)
![]()