Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baba-s/Kogane.ColorUtils
【Unity】Color 型と16進数、HTML カラー形式の文字列の変換ができる機能
https://github.com/baba-s/Kogane.ColorUtils
kogane-unity-lib
Last synced: 3 months ago
JSON representation
【Unity】Color 型と16進数、HTML カラー形式の文字列の変換ができる機能
- Host: GitHub
- URL: https://github.com/baba-s/Kogane.ColorUtils
- Owner: baba-s
- Created: 2020-05-01T11:03:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-30T05:51:00.000Z (11 months ago)
- Last Synced: 2024-05-15T13:22:44.306Z (6 months ago)
- Topics: kogane-unity-lib
- Language: C#
- Homepage:
- Size: 8.79 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kogane Color Utils
Color 型と16進数、HTML カラー形式の文字列の変換ができる機能
## 使用例
```cs
using Kogane;
using UnityEngine;public class Example : MonoBehaviour
{
private void Start()
{
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGB( 255, 128, 0 ) );// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGBA( 255, 128, 0, 255 ) );// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromARGB( 255, 255, 128, 0 ) );
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGB( 0xFF8000 ) );
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGBA( 0xFF8000FF ) );
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromARGB( 0xFFFF8000 ) );
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGB( "#FF8000" ) );
// RGBA(1.000, 0.502, 0.000, 1.000)
Debug.Log( ColorUtils.FromRGBA( "#FF8000FF" ) );// ff0000
Debug.Log( ColorUtils.ToRGBHtmlStringLower( Color.red ) );// ff0000ff
Debug.Log( ColorUtils.ToRGBAHtmlStringLower( Color.red ) );// fff0000
Debug.Log( ColorUtils.ToARGBHtmlStringLower( Color.red ) );// FF0000
Debug.Log( ColorUtils.ToRGBHtmlStringUpper( Color.red ) );// FF0000FF
Debug.Log( ColorUtils.ToRGBAHtmlStringUpper( Color.red ) );// FFFF0000
Debug.Log( ColorUtils.ToARGBHtmlStringUpper( Color.red ) );
}
}
```