NotesColorObject (JavaScript)

色を表します。

作成方法

NotesColorObject オブジェクトを作成するには、NotesSession の createColorObject メソッドを使用します。

使用法

Domino では、読み書き可能なプロパティ NotesColor と同様に、0 から 240 までの番号が付いた色が定義されます。 各 Domino カラーは、0 から 255 までの範囲の RGB (赤、緑、青) 値と 0 から 240 までの範囲の HSL (色相、彩度、明度) 値にマップされ、残りの読み取り専用プロパティも同様です。

NotesColor は、以下のプロパティ (RichTextStyle の Color、View の BackgroundColor、ViewColumn の FontColorHeaderFontColor) の値として使用できます。

以下の表に、定数により定義された、先頭の 16 色の Domino カラーの値を示します。 241 色すべての値を生成するには、コードの例を参照してください。

Notes® Red Grn Blue Hue Sat Lum 定数
0 0 0 0 160 0 0 RichTextStyle.COLOR_BLACK
1 255 255 255 160 0 240 RichTextStyle.COLOR_WHITE
2 255 0 0 0 240 120 RichTextStyle.COLOR_RED
3 0 255 0 80 240 120 RichTextStyle.COLOR_GREEN
4 0 0 255 160 240 120 RichTextStyle.COLOR_BLUE
5 255 255 0 200 240 120 RichTextStyle.COLOR_MAGENTA
6 255 255 0 40 240 120 RichTextStyle.COLOR_YELLOW
7 0 255 255 120 240 120 RichTextStyle.COLOR_CYAN
8 128 0 0 0 240 60 RichTextStyle.COLOR_DARK_RED
9 0 128 0 80 240 60 RichTextStyle.COLOR_DARK_GREEN
10 0 0 128 160 240 60 RichTextStyle.COLOR_DARK_BLUE
11 128 0 128 200 240 60 RichTextStyle.COLOR_DARK_MAGENTA
12 128 128 0 40 240 60 RichTextStyle.COLOR_DARK_YELLOW
13 0 128 128 120 240 60 RichTextStyle.COLOR_DARK_CYAN
14 120 128 128 160 0 120 RichTextStyle.COLOR_GRAY
15 192 192 192 160 0 181 RichTextStyle.COLOR_LIGHT_GRAY

以下のボタンは、それぞれの Domino カラーごとに 1 つの行が含まれる表を HTML でビルドし、リッチテキストコントロールにバインドされたスコープ変数にテキストを割り当てます。 各行は、Domino カラーコード、RGB 値、HSL 値を識別します。行は、その行に対応するカラーで表示されるため、表の背景色によっては、一部の行は見えません。
var color = session.createColorObject();
var text = '<table style="text-align:center;background-color:silver">';
// Generate header row
text = text + '<tr style="font-weight:bold">';
text = text + "<td>Notes</td>";
text = text + "<td>Red</td>";
text = text + "<td>Green</td>";
text = text + "<td>Blue</td>";
text = text + "<td>Hue</td>";
text = text + "<td>Saturation</td>";
text = text + "<td>Luminance</td>";
text = text + "</tr>";
for (var i=0; i<=240; i++) { // for each Notes color
	color.setNotesColor(i);
	// Get RGB, HSL, and generate hex values for RGB
	var red = color.getRed();
	var green = color.getGreen();
	var blue = color.getBlue();
	var hue = color.getHue();
	var saturation = color.getSaturation();
	var luminance = color.getLuminance();
	var redx = red.toString(16).toUpper().lpad("0", 2);
	var greenx = green.toString(16).toUpper().lpad("0", 2);
	var bluex = blue.toString(16).toUpper().lpad("0", 2);
	// Generate row for color
	text = text + '<tr style="font-weight:bold;color:#' + redx + greenx + bluex + '">';
	text = text + "<td>" + i + "</td>";
	text = text + "<td>" + red + "</td>";
	text = text + "<td>" + green + "</td>";
	text = text + "<td>" + blue + "</td>";
	text = text + "<td>" + hue + "</td>";
	text = text + "<td>" + saturation + "</td>";
	text = text + "<td>" + luminance + "</td>";
	text = text + "</tr>"
}
text = text + "</table>";
requestScope.colortable = text // bound to a rich text control