Skip to content

CMD rgb

zplutor edited this page Sep 29, 2023 · 3 revisions

RGB Command

Displays the color specified with RGB value.

Usage

rgb <color> [$<alpha>] 
    [/a] [/d] [/f] [/x]

color is a RGB value which can be one of the two formats:

  • Comma-separated format: R,G,B or R,G,B,A. Components can be following forms:

    • Integer, range from 0 to 255.
    • Float, range from 0 to 1.0.
    • Hex, range from 0x0 to 0xFF.

    All components must be the same form.

  • Hexadecimal format: #RRGGBB or #AARRGGBB.

    If A or AA is omitted, the opacity is 100%.

alpha specifies an additional alpha value to the color. It is prefixed with $. It can be integer, float or hex, which is the same as comma-separated format discussed above.

/a switch indicates that opacity of the result color will be reserved. If the opacity isn't 100%, it will be transformed to another color which opacity is 100% by default. For example, #CC000000 will be transformed to #FF333333. If you want to reserve the original opacity, you can specify /a switch. However, appearance of the color will not changed, because its opacity is combined with the white background.

/d, /f, /x switches indicate that RGB value of the result color will be displayed in comma-separated format, and each component will be displayed in integer, float, or hex form respectively. If none of them is specified, Hexadecimal format will be used as default.

Example

Display the semitransparent color using comma-separated format:
rgb 100,100,100 $0.5

Display the color using hexadecimal format, and convert it to comma-separated format:
rgb #CCA7B8D9 /d

Clone this wiki locally