Math formatting "Pro Tips" edition: Adding color to your answers! - "?"
3 Answers
I was playing around with mathjax the other day and I stumbled upon a way of adding color to a text.
I don't know if this could actually be useful or not, but I already know where I'll use color - stoichiometric coefficients, mole ratios, stuff like that.
The syntax looks like this
color(whatever color you want)(whatever text or math you want)
Here are some examples
- without the hashtags
color(red)(2 + 2 + 2)
- with the hashtags
#color(red)(2 + 2 + 2)#
- without the hashtags
color(blue)(2 + 2 + 2)
- with the hashtags
#color(blue)(2+2 + 2)#
Other examples:
#color(green)(ax^(2) + bx + c)#
#color(red)(2)C_2H_6 + color(blue)(7)O_2 -> color(green)(4)CO_2 + color(purple)(6)H_2O#
If you use color(black)(whatever), it will act as a regular bold text
Addendum
You can use color(white)(text) to write invisible characters. This is very useful for spacing issues
- without the hashtags
color(white)(222)
- with the hashtags
#color(white)(222) -># you can't see it, but it's there! Highlight it using your mouse!
Put hashtags around the following:
(color)("the type of color you want")("text you want to color")
Explanation:
For example, if I wanted to color the equation
hashtag (color)(blue)(x^2+1) hashtag
hashtag (color)(green)(x^2+1) hashtag
hashtag (color)(red)(x^2+1) hashtag
Press the edit answer button for this question if you want to take a look at the code.
This is an old (but still useful) answer; here are the possible values for "color" that can be used. Obviously many of these are too light to be useful. (Thanks to Tony B for suggesting these).
Explanation:
aliceblue:
antiquewhite:
aqua:
aquamarine:
azure:
beige:
bisque:
black:
blanchedalmond:
blue:
blueviolet:
brown:
burlywood:
cadetblue:
chartreuse:
chocolate:
coral:
cornflowerblue:
cornsilk:
crimson:
cyan:
darkblue:
darkcyan:
darkgoldenrod:
darkgray:
darkgreen:
darkkhaki:
darkmagenta:
darkolivegreen:
darkorange:
darkorchid:
darkred:
darksalmon:
darkseagreen:
darkslateblue:
darkslategray:
darkturquoise:
darkviolet:
deeppink:
deepskyblue:
dimgray:
dodgerblue:
firebrick:
floralwhite:
forestgreen:
fuchsia:
gainsboro:
ghostwhite:
gold:
goldenrod:
gray:
green:
greenyellow:
honeydew:
hotpink:
indianred:
indigo:
ivory:
khaki:
lavender:
lavenderblush:
lawngreen:
lemonchiffon:
lightblue:
lightcoral:
lightcyan:
lightgoldenrodyellow:
lightgreen:
lightgray:
lightmagenta:
lightpink:
lightsalmon:
lightseagreen:
lightskyblue:
lightslategray:
lightsteelblue:
lightyellow:
lime:
limegreen:
linen:
magenta:
maroon:
mediumaquamarine:
mediumblue:
mediumorchid:
mediumpurple:
mediumseagreen:
mediumslateblue:
mediumspringgreen:
mediumturquoise:
mediumvioletred:
midnightblue:
mintcream:
mistyrose:
moccasin:
navajowhite:
navy:
oldlace:
olive:
olivedrab:
orange:
orangered:
orchid:
palegoldenrod:
palegreen:
paleturquoise:
palevioletred:
papayawhip:
peachpuff:
peru:
pink:
plum:
powderblue:
purple:
red:
rosybrown:
royalblue:
saddlebrown:
salmon:
sandybrown:
seagreen:
seashell:
sienna:
silver:
skyblue:
slateblue:
slategray:
snow:
springgreen:
steelblue:
tan:
teal:
thistle:
tomato:
turquoise:
violet:
wheat:
white:
whitesmoke:
yellow:
yellowgreen: