16
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UnityのColorは定義されてる色が少なすぎる

Posted at

Color.red とか、まぁ原色ぽいのはあるんですけどね。

Wikipedia さんによると、こんなにあるらしいですよ?

https://en.wikipedia.org/wiki/List_of_colors:_A-F
https://en.wikipedia.org/wiki/List_of_colors:_G-M
https://en.wikipedia.org/wiki/List_of_colors:_N-Z

なので、この↑の色を定義したColorConstクラスを作りました。

もちろん手打ちしてられないので、各ページのテーブルの箇所をドラッグしてコピペして、T4Templateでソースコードに変換を。
色名にはスペースが入ってたり、スラッシュやピリオドが入ってたりでそのままだと変数名に出来ないので、適当に_とかブランクにReplace。
あと、全く同じ名前の色も存在したので、重複は削りました。

(行数が多すぎるのでgistへ)
https://gist.github.com/divide-by-zero/275c975d34f066ce3abe743f2ff16ea3

上記ファイルをAssetの配下どこでも良いので置いてけば

image.color = ColorConst.Wild_watermelon;

とか出来るようになります! やったね!

ワイルドウォーターメロンってどんな色だろう・・・。

16
15
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?