日本語 English
株式会社ヒューリンクス
TEL:03-5642-8384
営業時間:9:00-17:30

rgbcolor

トランスフォーム関数 rgbcolor は、0 から 255 までの引数 r, g, b を使って、対応する色をワークシートのセルに返します。この関数を使ってカスタムカラーをワークシート列に生成することで、グラフやプロットの任意の要素にこのカスタムカラーを適用することができます。

構文

rgbcolor(r, g, b)

引数 r, g, b は、使用する色の赤、緑、青の輝度成分をそれぞれ定義します。引数は 0~255 の間のスカラーで指定する必要があります。引数の数値が 0 未満または 255 より大きい場合は、0 もしくは 255 に切り捨てられます。

  • rgbcolor(255,0,0) は、赤を返します。
  • rgbcolor(0,255,0) は、緑を返します。
  • rgbcolor(0,0,255) は、青を返します。
  • 次の命令文では、等和色 (2種類の原色を均等に混ぜた色) である黄色、マゼンダ、シアンを列1の行 1~3 に配置します:
    cell(1,1)=rgbcolor(255,255,0)
    cell(1,2)=rgbcolor(255,0,255)
    cell(1,3)=rgbcolor(0,255,255)
  • 引数を同じ値にすると、生成される色は灰色になります。列1の上から 3つの行に黒、灰色、白を順番に配置にするには:
    cell(1,1)=rgbcolor(0,0,0)
    cell(1,2)=rgbcolor(127,127,127)
    cell(1,3)=rgbcolor(255,255,255)
    

rgbcolor

The transform function rgbcolor takes arguments r, g, and b between 0 and 255 and returns the corresponding color to cells in the worksheet. This function can be used to apply custom colors to any element of a graph or plot that can use colors chosen from a worksheet column.

Syntax

rgbcolor(r,g,b)

The r,g,b arguments define the red, green, and blue intensity portions of the color. These values must be scalars between 0 and 255. Numbers for the arguments less than 0 or greater than 255 are truncated to these values.

Example

The operation rgbcolor(255,0,0) returns red.

The operation rgbcolor(0,255,0) returns green.

The operation rgbcolor(0,0,255) returns blue.

  • The following statements place the secondary colors yellow, magenta, and cyan into rows 1, 2, and 3 into column 1:
    cell(1,1)=rgbcolor(255,255,0)
    cell(1,2)=rgbcolor(255,0,255)
    cell(1,3)=rgbcolor(0,255,255)
  • Shades of gray are generated using equal arguments. To place black, gray, and white in the first three rows of column 1:
    cell(1,1)=rgbcolor(0,0,0)
    cell(1,2)=rgbcolor(127,127,127)
    cell(1,3)=rgbcolor(255,255,255)