0%

解决MarkDown快捷键换字体颜色

解决MarkDown快捷键换字体颜色

第一步:下载AutoHotkey

第二步:在安装位置新建AutoHotKey.ahk文件

第三步:在文件中添加内容

AutoHotkey的实质就是使用快捷键在文字的前后添加一些内容,值得注意的是这里的Ctrl+Alt+R红色是带加粗的,如果不想要加粗需要删除**

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
; Typora
; 快捷增加字体颜色
; SendInput {Text} 解决中文输入法问题

#IfWinActive ahk_exe Typora.exe
{
; Ctrl+Alt+O 橙色
^!o::addFontColor("orange")

; Ctrl+Alt+R 红色
^!r::addFontColor("red")

; Ctrl+Alt+B 浅蓝色
^!b::addFontColor("cornflowerblue")

; Ctrl+Alt+Y 黄色
^!y::addFontColor("FFD00")

; Ctrl+Alt+Y 绿色
^!g::addFontColor("A2CD5A")
}

; 快捷增加字体颜色
addFontColor(color){
Send {ctrl down}c{ctrl up} ; 复制
SendInput {TEXT}<font color='%color%'>**
SendInput {ctrl down}v{ctrl up} ; 粘贴
If(clipboard = ""){
SendInput {TEXT}**</font> ; Typora 在这不会自动补充
}else{
SendInput {TEXT}**</ ; Typora中自动补全标签
}
}

使用时需要将AutoHotKey.ahk文件打开