1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DS9のRegionの色指定が分かりにくかったので、登録されている色名を一覧にしてみた

Last updated at Posted at 2025-12-29

はじめに

SAOImageDS9 で Region の色を変えようとしたとき、
「何が指定できるのか分からない」と感じたことはありませんか?

Region の色設定を見ると、次のような画面になります。

ds9_demo.png

ご覧の通り、メニュー上では

  • Black
  • White
  • Red
  • Green
  • Blue
  • Cyan
  • Magenta
  • Yellow

といった基本的な色しか表示されていません。

それ以外の色を指定しようとすると、
色名を入力する形式になっており、

どんな色が使えるのか分からない

と感じてしまいがちです。

この記事では、DS9 に登録されている色名を一覧としてまとめてみます。

色名は GitHub 上で管理されている

DS9 のソースコードを覗いてみると、
次のディレクトリに色の定義がまとまっています。

https://github.com/SAOImageDS9/SAOImageDS9/tree/master/ds9/icons/ui/colors

この中には、

  • red.png
  • skyblue.png
  • darkslategray.png

のように、色名をそのままファイル名にした PNG が並んでいます。

つまり、

このディレクトリにある PNG の名前 = DS9 で指定できる色名

という対応関係になっています。

色名と実際の色を一覧で見てみる

とはいえ、GitHub 上で PNG を 1 枚ずつ確認するのは少し手間です。

そこで、

DS9 に登録されている色名と、その実際の色を一覧で確認する

ためのスクリプトを書いてみました。

以下のスクリプトでは、

  1. GitHub API で colors ディレクトリを取得
  2. PNG ファイルを 1 枚ずつダウンロード
  3. 画像の中央ピクセルから色を取得
  4. 色名と HEX コードを表として出力

を行っています。

実装コードは Google Colab こちら からも実行できます。

(※ 各 PNG を個別に取得するため、実行には数秒〜十数秒程度かかります)

import requests
import pandas as pd
from PIL import Image
from io import BytesIO
import time

owner = "SAOImageDS9"
repo = "SAOImageDS9"
path = "ds9/icons/ui/colors"
branch = "master"

api_url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
files = requests.get(api_url).json()

rows = []

png_files = [f for f in files if f["name"].lower().endswith(".png")]
total = len(png_files)

start = time.time()

for i, f in enumerate(png_files, 1):
    name = f["name"]
    color_name = name.replace(".png", "")

    raw_url = (
        f"https://raw.githubusercontent.com/"
        f"{owner}/{repo}/{branch}/{path}/{name}"
    )

    print(f"[{i}/{total}] processing {name}")

    img_bytes = requests.get(raw_url).content
    img = Image.open(BytesIO(img_bytes)).convert("RGB")

    w, h = img.size
    r, g, b = img.getpixel((w // 2, h // 2))
    hex_code = f"#{r:02x}{g:02x}{b:02x}"

    rows.append({
        "color name": f"`{color_name}`",
        "preview": f'<img src="{raw_url}" width="15">',
        "HEX": f"`{hex_code}`",
    })

df = pd.DataFrame(rows).sort_values("color name")

elapsed = time.time() - start

print(f"\nTotal colors: {len(df)}")
print(f"Elapsed time: {elapsed:.2f} sec")
print(df.to_markdown(index=False))
出力一部抜粋
| color name             | preview                                                                                                                              | HEX       |
|:-----------------------|:-------------------------------------------------------------------------------------------------------------------------------------|:----------|
| `aliceblue`            | <img src="https://raw.githubusercontent.com/SAOImageDS9/SAOImageDS9/master/ds9/icons/ui/colors/aliceblue.png" width="15">            | `#f0f8ff` |
| `antiquewhite`         | <img src="https://raw.githubusercontent.com/SAOImageDS9/SAOImageDS9/master/ds9/icons/ui/colors/antiquewhite.png" width="15">         | `#faebd7` |
| `aquamarine`           | <img src="https://raw.githubusercontent.com/SAOImageDS9/SAOImageDS9/master/ds9/icons/ui/colors/aquamarine.png" width="15">           | `#7fffd4` |
| `azure`                | <img src="https://raw.githubusercontent.com/SAOImageDS9/SAOImageDS9/master/ds9/icons/ui/colors/azure.png" width="15">                | `#f0ffff` |
...

全部で、121色登録されていました。これをすべて並べてみます。

color name preview HEX
aliceblue #f0f8ff
antiquewhite #faebd7
aquamarine #7fffd4
azure #f0ffff
beige #f5f5dc
bisque #ffe4c4
black #000000
blanchedalmond #ffebcd
blue #0000ff
blueviolet #8a2be2
brown #a52a2a
burlywood #deb887
cadetblue #5f9ea0
chartreuse #7fff00
chocolate #d2691e
coral #ff7f50
cornflowerblue #6495ed
cornsilk #fff8dc
cyan #00ffff
darkgoldenrod #b8860b
darkgreen #006400
darkkhaki #bdb76b
darkolivegreen #556b2f
darkorange #ff8c00
darkorchid #9932cc
darksalmon #e9967a
darkseagreen #8fbc8f
darkslateblue #483d8b
darkslategray #2f4f4f
darkturquoise #00ced1
darkviolet #9400d3
deeppink #ff1493
deepskyblue #00bfff
dimgray #696969
dodgerblue #1e90ff
floralwhite #fffaf0
forestgreen #228b22
gainsboro #dcdcdc
ghostwhite #f8f8ff
gold #ffd700
goldenrod #daa520
green #00ff00
greenyellow #adff2f
grey #7e7e7e
honeydew #f0fff0
hotpink #ff69b4
indianred2 #ee6363
indianred #cd5c5c
ivory #fffff0
khaki #f0e68c
lavender #e6e6fa
lavenderblush #fff0f5
lawngreen #7cfc00
lemonchiffon #fffacd
lightblue #add8e6
lightcoral #f08080
lightcyan #e0ffff
lightgoldenrod #eedd82
lightgoldenrodyellow #fafad2
lightgray #d3d3d3
lightpink #ffb6c1
lightsalmon #ffa07a
lightseagreen #20b2aa
lightskyblue #87cefa
lightslateblue #8470ff
lightslategray #778899
lightsteelblue #b0c4de
lightyellow #ffffe0
limegreen #32cd32
linen #faf0e6
magenta #ff00ff
maroon #800000
mediumblue #0000cd
midnightblue #191970
mintcream #f5fffa
mistyrose #ffe4e1
moccasin #ffe4b5
navajowhite #ffdead
navyblue #000080
oldlace #fdf5e6
olivedrab #6b8e23
orange #ffa500
orangered #ff4500
orchid #da70d6
palegoldenrod #eee8aa
palegreen #98fb98
paleturquoise #afeeee
palevioletred #db7093
papayawhip #ffefd5
peachpuff #ffdab9
peru #cd853f
pink #ffc0cb
plum #dda0dd
powderblue #b0e0e6
purple #800080
red #ff0000
rosybrown #bc8f8f
royalblue #4169e1
saddlebrown #8b4513
salmon #fa8072
sandybrown #f4a460
seagreen #2e8b57
seashell #fff5ee
sienna #a0522d
skyblue #87ceeb
slateblue #6a5acd
slategray #708090
snow #fffafa
springgreen #00ff7f
steelblue #4682b4
tan #d2b48c
thistle #d8bfd8
tomato #ff6347
turquoise #40e0d0
violet #ee82ee
violetred #d02090
wheat #f5deb3
white #ffffff
whitesmoke #f5f5f5
yellow #ffff00
yellowgreen #9acd32

このように、実はいろんな色が使えます。

補足:HEX カラーコードも指定できる

ここまでで確認した一覧は、DS9 に 色名として登録されている色 の一覧です。
つまり、skybluedarkslategray のように 色名で指定できるのはこの範囲のみ ということになります。

一方で、DS9 の Region の色指定では HEX カラーコードを直接指定することも可能です。そのため、色名として登録されていない色であっても、HEX で表せる色であれば問題なく使用できます。

例えば、Region の Circle を「立教カラー」で表示したい場合でも、Other Color#684588 と入力するだけで反映されます。

まとめ

  • DS9 の Region の色指定は入力形式のため、何が使えるか分かりにくい
  • GitHub 上のソースコードには、多くの色名が定義されている
  • 一覧で確認すると、色指定の選択肢がかなり多いことが分かる
  • HEX を使えば、実質的にどんな色でも指定できる

「この色名、使えるのかな?」と迷ったときに、
一覧として活用していただけると幸いです。

関連記事

1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?