📄 colorstyle.hlp
字号:
{smcl}
{* 07mar2005}{...}
{cmd:help colorstyle}
{hline}
{* index colors}{...}
{* index areas, also see fill areas and colors}{...}
{* index fill areas, dimming and brightening}{...}
{* index color intensity adjustment}{...}
{* index intensity, color, adjustment of}{...}
{* index colors, dimming and brightening}{...}
{* index colorstyle it}{...}
{title:Title}
{p2colset 5 23 25 2}{...}
{p2col :{hi:[G] {it:colorstyle}} {hline 2}}Choices for color{p_end}
{p2colreset}{...}
{title:Syntax}
{col 9}{it:colorstyle}{col 35}description
{hline 66}
{col 9}{cmd:black}
{col 9}{cmd:gs0}{...}
{col 35}gray scale: 0 = {cmd:black}
{col 9}{cmd:gs1}{col 35}gray scale: very dark gray
{col 9}{cmd:gs2}
{col 9}.
{col 9}.
{col 9}{cmd:gs15}{col 35}gray scale: very light gray
{col 9}{cmd:gs16}{col 35}gray scale: 16 = {cmd:white}
{col 9}{cmd:white}
{col 9}{cmd:blue}
{col 9}{cmd:bluishgray}
{col 9}{cmd:brown}
{col 9}{cmd:cranberry}
{col 9}{cmd:cyan}
{col 9}{cmd:dimgray}{col 35}between {cmd:gs14} and {cmd:gs15}
{col 9}{cmd:dkgreen}{col 35}dark green
{col 9}{cmd:dknavy}{col 35}dark navy blue
{col 9}{cmd:dkorange}{col 35}dark orange
{col 9}{cmd:eggshell}
{col 9}{cmd:emerald}
{col 9}{cmd:forest_green}
{col 9}{cmd:gold}
{col 9}{cmd:gray}{col 35}equivalent to {cmd:gs8}
{col 9}{cmd:green}
{col 9}{cmd:khaki}
{col 9}{cmd:lavender}
{col 9}{cmd:lime}
{col 9}{cmd:ltblue}{col 35}light blue
{col 9}{cmd:ltbluishgray}{col 35}light blue-gray, used by scheme {cmd:s2color}
{col 9}{cmd:ltkhaki}{col 35}light khaki
{col 9}{cmd:magenta}
{col 9}{cmd:maroon}
{col 9}{cmd:midblue}
{col 9}{cmd:midgreen}
{col 9}{cmd:mint}
{col 9}{cmd:navy}
{col 9}{cmd:olive}
{col 9}{cmd:olive_teal}
{col 9}{cmd:orange}
{col 9}{cmd:orange_red}
{col 9}{cmd:pink}
{col 9}{cmd:purple}
{col 9}{cmd:red}
{col 9}{cmd:sand}
{col 9}{cmd:sandb}{col 35}bright sand
{col 9}{cmd:sienna}
{col 9}{cmd:stone}
{col 9}{cmd:teal}
{col 9}{cmd:yellow}
{col 35}colors used by {it:The Economist} magazine:
{col 9}{cmd:ebg}{col 35} background color
{col 9}{cmd:ebblue}{col 35} bright blue
{col 9}{cmd:edkblue}{col 35} dark blue
{col 9}{cmd:eltblue}{col 35} light blue
{col 9}{cmd:eltgreen}{col 35} light green
{col 9}{cmd:emidblue}{col 35} midblue
{col 9}{cmd:erose}{col 35} rose
{col 9}{cmd:none}{...}
{col 35}no color; invisible; draws nothing
{col 9}{cmd:background} or {cmd:bg}{...}
{col 35}same color as background
{col 9}{cmd:foreground} or {cmd:fg}{...}
{col 35}same color as foreground
{col 9}{it:# # #}{...}
{col 35}RGB value; {cmd:white} = {cmd:"255 255 255"}
{col 9}{it:# # # #}{...}
{col 35}CMYK value; {cmd:yellow} = {cmd:"0 0 255 0"}
{col 9}{it:color}{cmd:*}{it:#}{...}
{col 35}color with adjusted intensity
{col 9}{cmd:*}{it:#}{...}
{col 35}default color with adjusted intensity
{hline 66}
{p 8 8 2}
When specifying RGB or CMYK values, it is best to enclose the values in
quotes; type {cmd:"128} {cmd:128} {cmd:128"} not {cmd:128} {cmd:128}
{cmd:128}.
{pstd}
For a color palette showing an individual color, type
{cmd:. palette color} {it:colorstyle} {...}
[{cmd:,} {cmdab:sch:eme:(}{it:schemename}{cmd:)}]
{pstd}
and for a palette comparing two colors, type
{cmd:. palette color} {it:colorstyle} {it:colorstyle}{...}
[{cmd:,} {cmdab:sch:eme:(}{it:schemename}{cmd:)}]
{pstd}
For instance, you might type
{cmd:.} {bf:{stata palette color red green}}
{pstd}
See {helpb palette}.
{pstd}
Note that wherever a {it:colorstyle} appears, you can specify an RGB value by
specifying three numbers in sequence. Each number should be between 0 and
255, and the triplet indicates the amount of red, green, and blue to be mixed.
Each of the {it:colorstyle}s in the table above is equivalent to an RGB value.
{pstd}
You can also specify a CMYK value wherever {it:colorstyle} appears, but the
4 numbers representing a CMYK value must be enclosed in quotes, e.g.,
{cmd:"100 0 22 50"}.
{pstd}
Other {it:colorstyles} may be available; type
{p 8 8 2}
{cmd:.} {bf:{stata graph query colorstyle}}
{pstd}
to obtain the complete list of {it:colorstyles} installed on your computer.
{title:Description}
{pstd}
{it:colorstyle} specifies the color of a graphical component. You can specify
{it:colorstyle} with many different {cmd:graph} options; all have the form
<{it:object}>{cmd:color(}{it:colorstyle}{cmd:)}
{pstd}
For instance, option {cmd:mcolor()} specifies the color of markers, and option
{cmd:clcolor()} specifies the colors of connecting lines. Anywhere you see
{it:colorstyle}, you can choose from the list above.
{pstd}
You will sometimes see that a {it:colorstylelist} is allowed, as in
{cmd:. scatter} ...{cmd:, msymbol(}{it:colorstylelist}{cmd:)} ...
{pstd}
A {it:colorstylelist} is a sequence of {it:colorstyles} separated by spaces.
Shorthands are allowed to make specifying the list easier; see
{it:{help stylelists}}. When specifying RGB or CMYK values in
{it:colorstylelists}, remember to enclose the numbers in quotes.
{title:Remarks}
{pstd}
Remarks are presented under these headings:
{help colorstyle##remarks1:Colors are independent of the background color}
{help colorstyle##remarks2:White backgrounds and black backgrounds}
{help colorstyle##remarks3:RGB values}
{help colorstyle##remarks4:CMYK values}
{help colorstyle##remarks5:Adjusting intensity}
{marker remarks1}{...}
{title:Colors are independent of the background color}
{pstd}
With the exception of the colors {cmd:background} and {cmd:foreground}, colors
do not change because of the background color. Colors {cmd:background} and
{cmd:foreground} obviously do change, but otherwise, black means black, red
means red, white means white, and so on. White on a black background has high
visibility; white on a white background is invisible. Inversely, black on a
white background has high visibility; black on a black background is
invisible.
{pstd}
Color {cmd:foreground} always has high visibility.
{pstd}
Color {cmd:background} is the background color. If you draw something in this
color, you will erase whatever is underneath it.
{pstd}
Color {cmd:none} is no color at all. If you draw something in this color,
whatever you draw will be invisible. Being invisible, it will not hide
whatever is underneath it.
{marker remarks2}{...}
{title:White backgrounds and black backgrounds}
{pstd}
The colors do not change because of the background color, but the colors
that look best depend on the background color.
{pstd}
Graphs on the screen look best against a black background. With a black
background, light colors stand out, and dark colors blend into the
background.
{pstd}
Graphs on paper are usually presented against a white background.
Dark colors stand out and light colors blend into the background.
{pstd}
Because most users need to make printed copies of their graphs, Stata's
default is to present graphs on a white background, but you can change
that; see {help schemes}.
{pstd}
If you want a dark background, it is better to choose a dark background rather
than attempt to darken the background using the {it:region_option}
{cmd:graphregion(fcolor())} (see {it:{help region_options}}); everything else
about the graph's scheme will assume a background similar to how it was
originally.
{pstd}
{cmd:graphregion(fcolor())}
(and {cmd:graphregion(ifcolor())}, {cmd:plotregion(fcolor())}, and
{cmd:plotregion(ifcolor())}) are best used for adding a little tint to the
background.
{marker remarks3}{...}
{title:RGB values}
{pstd}
In addition to colors such as {cmd:red}, {cmd:green}, {cmd:blue},
{cmd:cyan}, etc., you can mix your own colors by specifying RGB values. An
RGB value is a triplet of numbers, each of which specifies, on a scale of 0 to
255, the amount of red, green, and blue to be mixed. That is,
{cmd:red} = {cmd:255 0 0}
{cmd:green} = {cmd: 0 255 0}
{cmd:blue} = {cmd: 0 0 255}
{cmd:cyan} = {cmd: 0 255 255}
{cmd:magenta} = {cmd:255 0 255}
{cmd:yellow} = {cmd:255 255 0}
{cmd:white} = {cmd:255 255 255}
{cmd:black} = {cmd: 0 0 0}
{pstd}
The overall scale of the triplet affects intensity; thus, changing 255 to
128 in all of the above would keep the colors the same but make them dimmer.
(Color {cmd:128} {cmd:128} {cmd:128} is what most people call gray.)
{marker remarks4}{...}
{title:CMYK values}
{pstd}
In addition to mixing your own colors using RGB values, you can mix your own
colors using CMYK values. If you have not heard of CMYK values or been asked
to produce CMYK color separations, you can safely skip this section. CMYK is
provided primarily to assist those doing color separations for mass printings.
While most inkjet printers use the more common RGB color values, printing
presses almost always require CMYK values for color separation.
{pstd}
RGB values represent a mixing of red, green, and blue light, whereas CMYK
values represent a mixing of pigments{hline 2}cyan, magenta, yellow, and black.
Thus as the numbers get bigger, RGB colors go from dark to bright, while
the CMYK colors go from light to dark.
{pstd}
CMYK values can be specified either as integers from 0 to 255, or as
proportions of ink using real numbers from 0.0 to 1.0. If all 4 values are 1
or less, the numbers are taken to be proportions of ink. Thus
{cmd:127 0 127 0} and {cmd:0.5 0 0.5 0} specify almost equivalent colors.
{pstd}
Some examples of CMYK colors are
{cmd:red} = {cmd: 0 255 255 0} or, equivalently, {cmd: 0 1 1 0}
{cmd:green} = {cmd:255 0 255 0} or, equivalently, {cmd: 1 0 1 0}
{cmd:blue} = {cmd:255 255 0 0} or, equivalently, {cmd: 1 1 0 0}
{cmd:cyan} = {cmd:255 0 0 0} or, equivalently, {cmd: 1 0 0 0}
{cmd:magenta} = {cmd: 0 255 0 0} or, equivalently, {cmd: 0 1 0 0}
{cmd:yellow} = {cmd: 0 0 255 0} or, equivalently, {cmd: 0 0 1 0}
{cmd:white} = {cmd: 0 0 0 0} or, equivalently, {cmd: 0 0 0 0}
{cmd:black} = {cmd: 0 0 0 255} or, equivalently, {cmd: 0 0 0 1}
{pstd}
For color representation, there is no reason for the K (black) component of
the CMYK values, {cmd: 255 255 255 0} and {cmd:0 0 0 255} both specify the
color black. With pigments such as printer inks, however, using 100% of cyan,
magenta, and yellow rarely produces a pure black. For that reason, CMYK
values include a specific black component.
{pstd}
Internally, Stata stores all colors as RGB values, even when CMYK values are
specified. This allows colors to be easily shown on most display devices. In
fact, {cmd:graph export} will produce graph files using RGB values, even when
CMYK values were specified as input. Only a few devices and graphics formats
understand CMYK colors, with PostScript and EPS formats being two of the most
important. To obtain CMYK colors in these formats, use the {cmd:cmyk(on)}
option of the {cmd:graph export} command. Alternately, you can specify that
all PostScript export files permanently use CMYK colors with the
command {cmd:translator set Graph2ps cmyk on} or
{cmd:translator set Graph2eps cmyk on} for EPS files.
{pstd}
Stata uses, for lack of a better term, normalized CMYK values. That simply
means that at least one of the CMY values is normalized to 0 for all CMYK
colors, with the K (black) value "absorbing" all parts of CM and Y where they
are all positive. An example may help: {cmd:10 10 5 0} is taken to be the
normalized CMYK value {cmd:5 5 0 5}. That is, all CMY colors were 5 or
greater, so this component was moved to black ink, and 5 was subtracted from
each of the CMY values. If you specify your CMYK colors in normalized form,
these will be exactly the values output by {cmd:graph export}, and you should
never be surprised by the resulting colors.
{marker remarks5}{...}
{title:Adjusting intensity}
{pstd}
To specify a color and modify its intensity (brightness), you might specify
things such as
{cmd:green*.8}
{cmd:red*1}
{cmd:purple*1.2}
{cmd:0 255 255*.8}
{pstd}
Multiplying a color
by 1 leaves the color unchanged. Multiplying by a number greater than 1 makes
the color stand out from the background more; multiplying by a number less
than 1 makes the color blend into the background more. For an example using
the intensity adjustment, see {hi:Typical use} in {helpb twoway_kdensity}.
{pstd}
When modifying intensity, the syntax is
{it:color}{cmd:*}{it:#}
{pstd}
or the color may be omitted:
{cmd:*}{it:#}
{pstd}
If the color is omitted, the intensity adjustment is applied to the default
color, given the context.
For instance, you specify {cmd:bcolor(*.7)} with {cmd:graph}
{cmd:twoway} {cmd:bar}{hline 2}or any other {cmd:graph} {cmd:twoway} command
that fills an area{hline 2}to use the default color at 70% intensity. Or you
specify {cmd:bcolor(*2)} to use the default color at twice its usual
intensity.
{pstd}
When you specify both the color and the adjustment, you must type the color
first: {cmd:.8*green} will not be understood. Also, do not put a space
between the {it:color} and the {cmd:*}, even when the {it:color} is an RGB
or CMYK value.
{pstd}
{it:color}{cmd:*0} makes the color as dim as possible, but it is not equivalent
to color {cmd:none}. {it:color}{cmd:*255} makes the color as bright as
possible, although values much smaller than 255 usually achieve the
same result.
{title:Also see}
{psee}
Manual: {bf:[G] {it:colorstyle}}
{psee}
Online: {help schemes}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -