Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rimurudev/unity-colorutility
ColorUtility is a compact and efficient class designed for working with colors in Unity. It facilitates easy conversion of hexadecimal color codes (in RRGGBB format) to Unity Color objects. This tool is particularly useful when working with color values obtained from external sources, such as web APIs, user interfaces, or text files.
https://github.com/rimurudev/unity-colorutility
rimuru-dev rimurudev unity unity-utilities utilities utility utils
Last synced: 24 days ago
JSON representation
ColorUtility is a compact and efficient class designed for working with colors in Unity. It facilitates easy conversion of hexadecimal color codes (in RRGGBB format) to Unity Color objects. This tool is particularly useful when working with color values obtained from external sources, such as web APIs, user interfaces, or text files.
- Host: GitHub
- URL: https://github.com/rimurudev/unity-colorutility
- Owner: RimuruDev
- Created: 2023-11-11T16:47:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-21T13:34:41.000Z (2 months ago)
- Last Synced: 2024-11-21T14:30:40.919Z (2 months ago)
- Topics: rimuru-dev, rimurudev, unity, unity-utilities, utilities, utility, utils
- Language: C#
- Homepage: https://t.me/DevLogUnity
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[English](README.md) | [Русский](README_RU.md)
⭐ColorUtility for Unity⭐
## Description
ColorUtility is a compact and efficient class designed for working with colors in Unity. It facilitates easy conversion of hexadecimal color codes (in RRGGBB format) to Unity `Color` objects. This tool is particularly useful when working with color values obtained from external sources, such as web APIs, user interfaces, or text files.## Features
- Simple conversion of hexadecimal color codes to Unity `Color` objects.
- Verification of input format correctness to enhance error resilience.
- Easily integrates into any Unity project.## Installation
To use `ColorUtility`, copy the `ColorUtility.cs` file into the `Scripts` or `Codebase` folder of your Unity project. Alternatively, you can download the ready-made `.package` in the Releases section.## Usage Examples
### Converting a Hexadecimal String to a Color
```csharp
Color color = ColorUtility.HexToColor("FF5733");
```This code converts the string "FF5733" into a Unity Color object, which can now be used for setting colors in your game or application.
## Handling Incorrect Input Data
If the passed string is incorrectly formatted, ColorUtility will return a white color and issue a warning in the Unity console.
```csharp
Color color = ColorUtility.HexToColor("IncorrectFormat"); // Returns Color.white
```
## Contributing to the Project
Suggestions for improvement or feedback are welcome! If you have ideas to enhance ColorUtility, feel free to create a pull request or issue in the GitHub repository.- Telegram channel - https://t.me/DevLogUnity
- Chat in Telegram - https://t.me/DevLogUnity3dLicense This project is distributed under the MIT License. See the LICENSE file for more details.
Author: RimuruDev
### TODO:
- Added package
- Fixed docs/readme