【Markdown笔记】设置字体颜色
【Markdown笔记】设置字体颜色
【Markdown笔记】设置字体颜色
HTML
字体颜色 Font colors
背景颜色 Background color
支持的颜色
LaTeX
字体颜色 Font colors
背景颜色 Background color
默认支持颜色 Colors supported
使用RGB颜色 Use RGB color
自定义颜色 Custom colors
参考资料
在Markdown下设置字体颜色和给字体背景设置颜色,主要使用HTML和LaTeX。
以下部分内容CSDN Markdown下不支持,我使用的Typora是支持的。
HTML
字体颜色 Font colors
修改字体颜色,选择颜色名称,例如:
Test,效果为Test。
或者是
Test,效果为Test。
修改字体颜色,选择16进制颜色值,例如:
Test,效果为Test。
或者是
Test,效果为Test。
背景颜色 Background color
该部分内容CSDN Markdown下不支持,我使用的Typora是支持的。
修改背景颜色,选择颜色名称,例如:
Test
Test
或者是
Test
Test
修改背景颜色,选择16进制颜色值,例如:
Test
Test
或者是
Test
Test
支持的颜色
颜色可以选择下表的颜色名称,或者根据RGB值。
支持的各种颜色名称如下:
HTML示例示例效果颜色名称16进制
Test
Test
AliceBlue
#F0F8FF
Test
Test
AntiqueWhite
#FAEBD7
Test
Test
Aqua
#00FFFF
Test
Test
Aquamarine
#7FFFD4
Test
Test
Azure
#F0FFFF
Test
Test
Beige
#F5F5DC
Test
Test
Bisque
#FFE4C4
Test
Test
Black
#000000
Test
Test
BlanchedAlmond
#FFEBCD
Test
Test
Blue
#0000FF
Test
Test
BlueViolet
#8A2BE2
Test
Test
Brown
#A52A2A
Test
Test
BurlyWood
#DEB887
Test
Test
CadetBlue
#5F9EA0
Test
Test
Chartreuse
#7FFF00
Test
Test
Chocolate
#D2691E
Test
Test
Coral
#FF7F50
Test
Test
CornflowerBlue
#6495ED
Test
Test
Cornsilk
#FFF8DC
Test
Test
Crimson
#DC143C
Test
Test
Cyan
#00FFFF
Test
Test
DarkBlue
#00008B
Test
Test
DarkCyan
#008B8B
Test
Test
DarkGoldenRod
#B8860B
Test
Test
DarkGray
#A9A9A9
Test
Test
DarkGreen
#006400
Test
Test
DarkKhaki
#BDB76B
Test
Test
DarkMagenta
#8B008B
Test
Test
DarkOliveGreen
#556B2F
Test
Test
Darkorange
#FF8C00
Test
Test
DarkOrchid
#9932CC
Test
Test
DarkRed
#8B0000
Test
Test
DarkSalmon
#E9967A
Test
Test
DarkSeaGreen
#8FBC8F
Test
Test
DarkSlateBlue
#483D8B
Test
Test
DarkSlateGray
#2F4F4F
Test
Test
DarkTurquoise
#00CED1
Test
Test
DarkViolet
#9400D3
Test
Test
DeepPink
#FF1493
Test
Test
DeepSkyBlue
#00BFFF
Test
Test
DimGray
#696969
Test
Test
DodgerBlue
#1E90FF
Test
Test
Feldspar
#D19275
Test
Test
FireBrick
#B22222
Test
Test
FloralWhite
#FFFAF0
Test
Test
ForestGreen
#228B22
Test
Test
Fuchsia
#FF00FF
Test
Test
Gainsboro
#DCDCDC
Test
Test
GhostWhite
#F8F8FF
Test
Test
Gold
#FFD700
Test
Test
GoldenRod
#DAA520
Test
Test
Gray
#808080
Test
Test
Green
#008000
Test
Test
GreenYellow
#ADFF2F
Test
Test
HoneyDew
#F0FFF0
Test
Test
HotPink
#FF69B4
Test
Test
IndianRed
#CD5C5C
Test
Test
Indigo
#4B0082
Test
Test
Ivory
#FFFFF0
Test
Test
Khaki
#F0E68C
Test
Test
Lavender
#E6E6FA
Test
Test
LavenderBlush
#FFF0F5
Test
Test
LawnGreen
#7CFC00
Test
Test
LemonChiffon
#FFFACD
Test
Test
LightBlue
#ADD8E6
Test
Test
LightCoral
#F08080
Test
Test
LightCyan
#E0FFFF
Test
Test
LightGoldenRodYellow
#FAFAD2
Test
Test
LightGrey
#D3D3D3
Test
Test
LightGreen
#90EE90
Test
Test
LightPink
#FFB6C1
Test
Test
LightSalmon
#FFA07A
Test
Test
LightSeaGreen
#20B2AA
Test
Test
LightSkyBlue
#87CEFA
Test
Test
LightSlateBlue
#8470FF
Test
Test
LightSlateGray
#778899
Test
Test
LightSteelBlue
#B0C4DE
Test
Test
LightYellow
#FFFFE0
Test
Test
Lime
#00FF00
Test
Test
LimeGreen
#32CD32
Test
Test
Linen
#FAF0E6
Test
Test
Magenta
#FF00FF
Test
Test
Maroon
#800000
Test
Test
MediumAquaMarine
#66CDAA
Test
Test
MediumBlue
#0000CD
Test
Test
MediumOrchid
#BA55D3
Test
Test
MediumPurple
#9370D8
Test
Test
MediumSeaGreen
#3CB371
Test
Test
MediumSlateBlue
#7B68EE
Test
Test
MediumSpringGreen
#00FA9A
Test
Test
MediumTurquoise
#48D1CC
Test
Test
MediumVioletRed
#C71585
Test
Test
MidnightBlue
#191970
Test
Test
MintCream
#F5FFFA
Test
Test
MistyRose
#FFE4E1
Test
Test
Moccasin
#FFE4B5
Test
Test
NavajoWhite
#FFDEAD
Test
Test
Navy
#000080
Test
Test
OldLace
#FDF5E6
Test
Test
Olive
#808000
Test
Test
OliveDrab
#6B8E23
Test
Test
Orange
#FFA500
Test
Test
OrangeRed
#FF4500
Test
Test
Orchid
#DA70D6
Test
Test
PaleGoldenRod
#EEE8AA
Test
Test
PaleGreen
#98FB98
Test
Test
PaleTurquoise
#AFEEEE
Test
Test
PaleVioletRed
#D87093
Test
Test
PapayaWhip
#FFEFD5
Test
Test
PeachPuff
#FFDAB9
Test
Test
Peru
#CD853F
Test
Test
Pink
#FFC0CB
Test
Test
Plum
#DDA0DD
Test
Test
PowderBlue
#B0E0E6
Test
Test
Purple
#800080
Test
Test
Red
#FF0000
Test
Test
RosyBrown
#BC8F8F
Test
Test
RoyalBlue
#4169E1
Test
Test
SaddleBrown
#8B4513
Test
Test
Salmon
#FA8072
Test
Test
SandyBrown
#F4A460
Test
Test
SeaGreen
#2E8B57
Test
Test
SeaShell
#FFF5EE
Test
Test
Sienna
#A0522D
Test
Test
Silver
#C0C0C0
Test
Test
SkyBlue
#87CEEB
Test
Test
SlateBlue
#6A5ACD
Test
Test
SlateGray
#708090
Test
Test
Snow
#FFFAFA
Test
Test
SpringGreen
#00FF7F
Test
Test
SteelBlue
#4682B4
Test
Test
Tan
#D2B48C
Test
Test
Teal
#008080
Test
Test
Thistle
#D8BFD8
Test
Test
Tomato
#FF6347
Test
Test
Turquoise
#40E0D0
Test
Test
Violet
#EE82EE
Test
Test
VioletRed
#D02090
Test
Test
Wheat
#F5DEB3
Test
Test
White
#FFFFFF
Test
Test
WhiteSmoke
#F5F5F5
Test
Test
Yellow
#FFFF00
Test
Test
YellowGreen
#9ACD32
LaTeX
CSDN Markdown下使用的KaTeX,以下内容支持度不高。
字体颜色 Font colors
1.使用\color
修改字体颜色使用LaTeX公式$\color{options}{text}$。options选择颜色,text选择公式内容。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\color{Green}{y = ax^2 + bx + c}$
y = a x 2 + b x + c \color{Green}{y = ax^2 + bx + c}y=ax2+bx+c
2
$\color{Orange}{y} = \color{Red}{kx} + \color{Blue}{b}$
y = k x + b \color{Orange}{y} = \color{Red}{kx} + \color{Blue}{b}y=kx+b
3
${\color{Emerald}z^2} = {\color{Yellow}x^2} + {\color{Cyan}y^2}$
z 2 = x 2 + y 2 {\color{Emerald}z^2} = {\color{Yellow}x^2} + {\color{Cyan}y^2}z2=x2+y2
2.使用\textcolor
修改字体颜色使用LaTeX公式$\textcolor{options}{text}$。options选择颜色,text选择公式内容。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\textcolor{Green}{y = ax^2 + bx + c}$
y = a x 2 + b x + c \textcolor{Green}{y = ax^2 + bx + c}y=ax2+bx+c
2
$\textcolor{Orange}{y} = \textcolor{Red}{kx} + \textcolor{Blue}{b}$
y = k x + b \textcolor{Orange}{y} = \textcolor{Red}{kx} + \textcolor{Blue}{b}y=kx+b
3
${\textcolor{Emerald}z^2} = {\textcolor{Yellow}x^2} + {\textcolor{Cyan}y^2}$
z 2 = x 2 + y 2 {\textcolor{Emerald}z^2} = {\textcolor{Yellow}x^2} + {\textcolor{Cyan}y^2}z2=x2+y2
背景颜色 Background color
修改背景颜色使用LaTeX公式$\colorbox{options}{text}$。options选择颜色,text选择文本内容。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\colorbox{Green}{y = ax + bx + c}$
y = ax + bx + c \colorbox{Green}{y = ax + bx + c}y = ax + bx + c
2
$\colorbox{Orange}{y} = \colorbox{Red}{kx} + \colorbox{Blue}{b}$
y = kx + b \colorbox{Orange}{y} = \colorbox{Red}{kx} + \colorbox{Blue}{b}y=kx+b
3
${\colorbox{Emerald}z^2} = {\colorbox{Yellow}x^2} + {\colorbox{Cyan}y^2}$
z 2 = x 2 + y 2 {\colorbox{Emerald}z^2} = {\colorbox{Yellow}x^2} + {\colorbox{Cyan}y^2}z2=x2+y2
默认支持颜色 Colors supported
该部分内容CSDN Markdown下,部分颜色是不支持的,我使用的Typora是支持的。
下面列举支持的颜色名称。
序号LaTeX公式LaTeX示例LaTeX示例效果名称说明
1
$\color{Apricot}$
$\color{Apricot}Test$
T e s t \color{Apricot}TestTest
Apricot
杏黄色
2
$\color{Aquamarine}$
$\color{Aquamarine}Test$
T e s t \color{Aquamarine}TestTest
Aquamarine
碧绿色
3
$\color{Bittersweet}$
$\color{Bittersweet}Test$
T e s t \color{Bittersweet}TestTest
Bittersweet
深桔红色
4
$\color{Black}$
$\color{Black}Test$
T e s t \color{Black}TestTest
Black
黑色
5
$\color{Blue}$
$\color{Blue}Test$
T e s t \color{Blue}TestTest
Blue
蓝色
6
$\color{BlueGreen}$
$\color{BlueGreen}Test$
T e s t \color{BlueGreen}TestTest
BlueGreen
蓝绿色
7
$\color{BlueViolet}$
$\color{BlueViolet}Test$
T e s t \color{BlueViolet}TestTest
BlueViolet
蓝紫色
8
$\color{BrickRed}$
$\color{BrickRed}Test$
T e s t \color{BrickRed}TestTest
BrickRed
砖红色
9
$\color{Brown}$
$\color{Brown}Test$
T e s t \color{Brown}TestTest
Brown
棕色
10
$\color{BurntOrange}$
$\color{BurntOrange}Test$
T e s t \color{BurntOrange}TestTest
BurntOrange
深橙黄色
11
$\color{CadetBlue}$
$\color{CadetBlue}Test$
T e s t \color{CadetBlue}TestTest
CadetBlue
军蓝色
12
$\color{CarnationPink}$
$\color{CarnationPink}Test$
T e s t \color{CarnationPink}TestTest
CarnationPink
康乃馨粉
13
$\color{Cerulean}$
$\color{Cerulean}Test$
T e s t \color{Cerulean}TestTest
Cerulean
天蓝色
14
$\color{CornflowerBlue}$
$\color{CornflowerBlue}Test$
T e s t \color{CornflowerBlue}TestTest
CornflowerBlue
矢菊花蓝
15
$\color{Cyan}$
$\color{Cyan}Test$
T e s t \color{Cyan}TestTest
Cyan
青色
16
$\color{Dandelion}$
$\color{Dandelion}Test$
T e s t \color{Dandelion}TestTest
Dandelion
蒲公英
17
$\color{DarkOrchid}$
$\color{DarkOrchid}Test$
T e s t \color{DarkOrchid}TestTest
DarkOrchid
深兰花紫
18
$\color{Emerald}$
$\color{Emerald}Test$
T e s t \color{Emerald}TestTest
Emerald
祖母绿
19
$\color{ForestGreen}$
$\color{ForestGreen}Test$
T e s t \color{ForestGreen}TestTest
ForestGreen
森林绿
20
$\color{Fuchsia}$
$\color{Fuchsia}Test$
T e s t \color{Fuchsia}TestTest
Fuchsia
紫红色
21
$\color{Goldenrod}$
$\color{Goldenrod}Test$
T e s t \color{Goldenrod}TestTest
Goldenrod
金麒麟色
22
$\color{Gray}$
$\color{Gray}Test$
T e s t \color{Gray}TestTest
Gray
灰色
23
$\color{Green}$
$\color{Green}Test$
T e s t \color{Green}TestTest
Green
绿色
24
$\color{GreenYellow}$
$\color{GreenYellow}Test$
T e s t \color{GreenYellow}TestTest
GreenYellow
黄绿色
25
$\color{JungleGreen}$
$\color{JungleGreen}Test$
T e s t \color{JungleGreen}TestTest
JungleGreen
深草绿
26
$\color{Lavender}$
$\color{Lavender}Test$
T e s t \color{Lavender}TestTest
Lavender
淡紫色
27
$\color{LimeGreen}$
$\color{LimeGreen}Test$
T e s t \color{LimeGreen}TestTest
LimeGreen
橙绿色
28
$\color{Magenta}$
$\color{Magenta}Test$
T e s t \color{Magenta}TestTest
Magenta
品红色
29
$\color{Mahogany}$
$\color{Mahogany}Test$
T e s t \color{Mahogany}TestTest
Mahogany
红褐色
30
$\color{Maroon}$
$\color{Maroon}Test$
T e s t \color{Maroon}TestTest
Maroon
褐红色
31
$\color{Melon}$
$\color{Melon}Test$
T e s t \color{Melon}TestTest
Melon
32
$\color{MidnightBlue}$
$\color{MidnightBlue}Test$
T e s t \color{MidnightBlue}TestTest
MidnightBlue
午夜蓝
33
$\color{Mulberry}$
$\color{Mulberry}Test$
T e s t \color{Mulberry}TestTest
Mulberry
深紫红色
34
$\color{NavyBlue}$
$\color{NavyBlue}Test$
T e s t \color{NavyBlue}TestTest
NavyBlue
藏青色
35
$\color{OliveGreen}$
$\color{OliveGreen}Test$
T e s t \color{OliveGreen}TestTest
OliveGreen
橄榄绿
36
$\color{Orange}$
$\color{Orange}Test$
T e s t \color{Orange}TestTest
Orange
橙色
37
$\color{OrangeRed}$
$\color{OrangeRed}Test$
T e s t \color{OrangeRed}TestTest
OrangeRed
橙红色
38
$\color{Orchid}$
$\color{Orchid}Test$
T e s t \color{Orchid}TestTest
Orchid
淡紫色
39
$\color{Peach}$
$\color{Peach}Test$
T e s t \color{Peach}TestTest
Peach
桃红色
40
$\color{Periwinkle}$
$\color{Periwinkle}Test$
T e s t \color{Periwinkle}TestTest
Periwinkle
蔓长春花
41
$\color{PineGreen}$
$\color{PineGreen}Test$
T e s t \color{PineGreen}TestTest
PineGreen
松绿色
42
$\color{Plum}$
$\color{Plum}Test$
T e s t \color{Plum}TestTest
Plum
紫红色
43
$\color{ProcessBlue}$
$\color{ProcessBlue}Test$
T e s t \color{ProcessBlue}TestTest
ProcessBlue
工艺蓝
44
$\color{Purple}$
$\color{Purple}Test$
T e s t \color{Purple}TestTest
Purple
紫色
45
$\color{RawSienna}$
$\color{RawSienna}Test$
T e s t \color{RawSienna}TestTest
RawSienna
黄赭色
46
$\color{Red}$
$\color{Red}Test$
T e s t \color{Red}TestTest
Red
红色
47
$\color{RedOrange}$
$\color{RedOrange}Test$
T e s t \color{RedOrange}TestTest
RedOrange
橘红色
48
$\color{RedViolet}$
$\color{RedViolet}Test$
T e s t \color{RedViolet}TestTest
RedViolet
紫红色
49
$\color{Rhodamine}$
$\color{Rhodamine}Test$
T e s t \color{Rhodamine}TestTest
Rhodamine
罗丹明
50
$\color{RoyalBlue}$
$\color{RoyalBlue}Test$
T e s t \color{RoyalBlue}TestTest
RoyalBlue
宝蓝色
51
$\color{RoyalPurple}$
$\color{RoyalPurple}Test$
T e s t \color{RoyalPurple}TestTest
RoyalPurple
蓝紫色
52
$\color{RubineRed}$
$\color{RubineRed}Test$
T e s t \color{RubineRed}TestTest
RubineRed
宝石红
53
$\color{Salmon}$
$\color{Salmon}Test$
T e s t \color{Salmon}TestTest
Salmon
鲜肉色
54
$\color{SeaGreen}$
$\color{SeaGreen}Test$
T e s t \color{SeaGreen}TestTest
SeaGreen
海绿色
55
$\color{Sepia}$
$\color{Sepia}Test$
T e s t \color{Sepia}TestTest
Sepia
棕黑色
56
$\color{SkyBlue}$
$\color{SkyBlue}Test$
T e s t \color{SkyBlue}TestTest
SkyBlue
天蓝色
57
$\color{SpringGreen}$
$\color{SpringGreen}Test$
T e s t \color{SpringGreen}TestTest
SpringGreen
春绿色
58
$\color{Tan}$
$\color{Tan}Test$
T e s t \color{Tan}TestTest
Tan
棕褐色
59
$\color{TealBlue}$
$\color{TealBlue}Test$
T e s t \color{TealBlue}TestTest
TealBlue
水鸭蓝
60
$\color{Thistle}$
$\color{Thistle}Test$
T e s t \color{Thistle}TestTest
Thistle
蓟色
61
$\color{Turquoise}$
$\color{Turquoise}Test$
T e s t \color{Turquoise}TestTest
Turquoise
蓝绿色
62
$\color{Violet}$
$\color{Violet}Test$
T e s t \color{Violet}TestTest
Violet
紫罗兰色
63
$\color{VioletRed}$
$\color{VioletRed}Test$
T e s t \color{VioletRed}TestTest
VioletRed
紫红色
64
$\color{White}$
$\color{White}Test$
T e s t \color{White}TestTest
White
白色
65
$\color{WildStrawberry}$
$\color{WildStrawberry}Test$
T e s t \color{WildStrawberry}TestTest
WildStrawberry
野草莓
66
$\color{Yellow}$
$\color{Yellow}Test$
T e s t \color{Yellow}TestTest
Yellow
黄色
67
$\color{YellowGreen}$
$\color{YellowGreen}Test$
T e s t \color{YellowGreen}TestTest
YellowGreen
黄绿色
68
$\color{YellowOrange}$
$\color{YellowOrange}Test$
T e s t \color{YellowOrange}TestTest
YellowOrange
黄橙色
使用RGB颜色 Use RGB color
该部分内容CSDN Markdown下不支持,我使用的Typora是支持的。
1.RGB
要使用RGB颜色,使用LaTeX公式$\color[RGB]{R,G,B}{text}$或$\textcolor[RGB]{R,G,B}{text}$。R是红色分量,G是绿色分量,B是蓝色分量,范围0 - 255。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\color[RGB]{0,200,0}{y = ax^2 + bx + c}$
KaTeX parse error: Expected '{', got '[' at position 7: \color[̲RGB]{0,200,0}{y…
2
$\color[RGB]{80,50,200}{y} = \color[RGB]{160,30,100}{kx} + \color[RGB]{130,90,120}{b}$
KaTeX parse error: Expected '{', got '[' at position 7: \color[̲RGB]{80,50,200}…
3
${\color[RGB]{200,120,10}z^2} = {\color[RGB]{110,110,10}x^2} + {\color[RGB]{20,70,30}y^2}$
KaTeX parse error: Expected '{', got '[' at position 8: {\color[̲RGB]{200,120,10…
4
$\textcolor[RGB]{0,200,0}{y = ax^2 + bx + c}$
KaTeX parse error: Expected '{', got '[' at position 11: \textcolor[̲RGB]{0,200,0}{y…
2.rgb
要使用rgb颜色,使用LaTeX公式$\color[rgb]{r,g,b}$或$\textcolor[rgb]{r,g,b}$。r是红色分量,g是绿色分量,b是蓝色分量,范围0 - 1。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\color[rgb]{0,0.9,0}{y = ax^2 + bx + c}$
KaTeX parse error: Expected '{', got '[' at position 7: \color[̲rgb]{0,0.9,0}{y…
2
$\color[rgb]{0.2,0.1,0.9}{y} = \color[rgb]{0.7,0.25,0.33}{kx} + \color[rgb]{0.4,0.35,0.5}{b}$
KaTeX parse error: Expected '{', got '[' at position 7: \color[̲rgb]{0.2,0.1,0.…
3
${\color[rgb]{0.85,0.36,0.05}z^2} = {\color[rgb]{0.29,0.36,0.08}x^2} + {\color[rgb]{0.07,0.24,0.16}y^2}$
KaTeX parse error: Expected '{', got '[' at position 8: {\color[̲rgb]{0.85,0.36,…
4
$\textcolor[rgb]{0,0.9,0}{y = ax^2 + bx + c}$
KaTeX parse error: Expected '{', got '[' at position 11: \textcolor[̲rgb]{0,0.9,0}{y…
自定义颜色 Custom colors
该部分内容CSDN Markdown下不支持,我使用的Typora是支持的。
要自己定义颜色,使用LaTeX公式$\definecolor{name}{RGB}{R,G,B}$或$\definecolor{name}{rgb]{r,g,b}$,name是自定义颜色名称。
如以下示例程序:
序号LaTeX公式LaTeX示例效果
1
$\definecolor{testcolor}{RGB}{0,200,0} {\color{Blue}{y = 2x} + \color{testcolor}1}$
KaTeX parse error: Undefined control sequence: \definecolor at position 1: \̲d̲e̲f̲i̲n̲e̲c̲o̲l̲o̲r̲{testcolor}{RGB…
2
$\definecolor{testcolor}{rgb}{0,0.8,0} {\color{Blue}{y = 2x} + \color{testcolor}1}$
KaTeX parse error: Undefined control sequence: \definecolor at position 1: \̲d̲e̲f̲i̲n̲e̲c̲o̲l̲o̲r̲{testcolor}{rgb…
参考资料
HTML 颜色名
LaTeX公式编辑器——帮助文档
本文链接:https://blog.csdn.net/u012028275/article/details/115445362