1、下载并安装 AutoHotkey

(具体步骤可自行百度)

  1. 访问 AutoHotkey 主页: https://autohotkey.com/
  2. 点击下载: https://autohotkey.com/download/ahk-install.exe

2、配置文件

桌面新建文本文件 MyHotkeyScript.ahk 将以下代码复制进去保存

注意文件后缀.ahk

示例代码如下

; 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")
} ; 快捷增加字体颜色
addFontColor(color){
clipboard := "" ; 清空剪切板
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中自动补全标签
}
}

3、运行软件

  • 双击运行(使用AutoHotkey运行)
  • 右键 MyHotkeyScript.ahk 脚本文件,点击Compile Script编译脚本成exe程序,可以不用下载Autohotkey在其他电脑上运行了;

上面脚本只写了三种颜色,可以按自己需求修改,增加其他颜色和快捷方式!

颜色中英对照参考网站:

https://www.5tu.cn/colors/yansezhongwenming.html

; Typora
; 快捷增加字体颜色
; SendInput {Text} 解决中文输入法问题 #IfWinActive ahk_exe Typora.exe
{
; Ctrl+Alt+g 绿色
^!g::addFontColor("green") ; Ctrl+Alt+p 紫色
^!p::addFontColor("purple") ; Ctrl+Alt+o 橙色
^!o::addFontColor("orange") ; Ctrl+Alt+r 红色
^!r::addFontColor("red") ; Ctrl+Alt+b 浅蓝色
^!b::addFontColor("cornflowerblue") ; Ctrl+Alt+m 午夜蓝
^!m::addFontColor("midnightblue") } ; 快捷增加字体颜色
addFontColor(color){
clipboard := "" ; 清空剪切板
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中自动补全标签
}
}

参考文档

https://www.itblogcn.com/article/583.html

Typora 快捷方式给字体设置颜色的更多相关文章

  1. NPOI简单的给某个单元格字体设置颜色

    参考文档有: https://www.cnblogs.com/gossip/p/4307486.html https://bbs.csdn.net/topics/391042064?page=1 效果 ...

  2. LateX的简单字体设置(颜色,居中,大小等)

    \(\color{red}{Ⅰ.文本单行居中}\) $$\text{我是蒟蒻}$$ \[\text{我是蒟蒻} \] \(\color{Black}{Ⅱ.设置字体颜色}\) $$\color{Purp ...

  3. UITabBar 设置字体的颜色(选中状态/正常状态)setTitleTextAttributes

    UITabbar有个setTintColor这个方法,可以理解为,高亮的时候,或者点击后的颜色设置. UITabBarItem有个setTitleTextAttributes的方法,是用来设置字体的颜 ...

  4. eclipse 软件的背景颜色、字体设置

    1.eclipse 背景色设置: Window->Preferences->General->Editors->Text Editors->Backgroud color ...

  5. eclipse 部分颜色及部分字体设置

    eclipse整体代码的颜色风格可以用插件 eclipse color theme 更改. 但尽管如此,有些颜色仍不是最满意的,还需自己设计. 1. 光标选中字体的颜色,如图 一个openItem被选 ...

  6. GUI颜色、字体设置对话框

    %颜色设置对话框 uisetcolor %c 红色 c=uisetcolor %默认规定颜色 c=uisetcolor([ ]); %设置曲线颜色 h = plot([:]); c = uisetco ...

  7. iOS开发-- 设置UIButton的文字显示位置、字体的大小、字体的颜色

    btn.frame = CGRectMake(x, y, width, height); [btn setTitle: @"search" forState: UIControlS ...

  8. MathType中怎么设置字体默认颜色

    MathType功能非常强大,在编辑公式时使用非常方便.利用MathType破解版不仅可以改变公式的字体和字号,也可以改变公式字体颜色.有时在编辑完成后需要对MathType公式格式全部进行修改,这时 ...

  9. SecureCRT 设置字体跟颜色

    SecureCRT 绝佳配色方案, 保护你的眼睛 分类: Linux 软件使用2013-05-17 08:45 24038人阅读 评论(11) 收藏 举报 SecureCRT 绝佳配色方案, 保护你的 ...

  10. 设置UIButton的文字显示位置、字体的大小、字体的颜色

    btn.frame = CGRectMake(x, y, width, height); [btn setTitle: @"search" forState: UIControlS ...

随机推荐

  1. JMS微服务项目模板

    项目模板下载地址 vs2022模板:JMS.MicroServiceProjectTemplate2022.zip vs2019模板:JMS.MicroServiceHost.zip 说明 把压缩包解 ...

  2. Spring——AOP练习

    模仿前面的例子,完成模拟JDBC操作 1.UserDAO接口,具有insert(String name)方法,UserDAOImpl实现它 2. 用前置增强,在插入之前,完成数据库连接.事务创建工作 ...

  3. [转帖]如何不耍流氓的做运维之-SHELL脚本

    https://www.cnblogs.com/luoahong/articles/8504691.html 前言 大家都是文明人,尤其是做运维的,那叫一个斯文啊.怎么能耍流氓呢?赶紧看看,编写SHE ...

  4. [转帖]prometheus node-exporter 全部指标说明

    https://www.cnblogs.com/276815076/p/16383615.html Basic CPU / Mem / Disk Info Basic CPU / Mem / Disk ...

  5. [转帖]sqluldr2 oracle直接导出数据为文本的小工具使用

    https://www.cnblogs.com/ocp-100/p/11098373.html 近期客户有需求,导出某些审计数据,供审计人进行核查,只能导出成文本或excel格式的进行查看,这里我们使 ...

  6. [转帖]PostgreSQL 的性能调优方法

    https://juejin.cn/post/7119489847529570334 浅谈PostgreSQL的性能调校 PostgreSQL的性能调校是指调校数据库以提高性能和快速访问数据:我们可以 ...

  7. [转帖]Kafka—配置SASL/PLAIN认证客户端及常用操作命令

    介绍   SASL/PLAIN 是一种简单的 username/password安全认证机制,本文主要总结服务端开启该认证后,命令行客户端进行配置的操作流程. 配置 增加jaas.properties ...

  8. SMEE 国内最新光刻机

  9. 你也能成为“黑客”高手——趣谈Linux Shell编程语言

    作者:京东零售 杜兴文 我们看过很多在电脑命令行敲一些命令并给观众展示很高科技的画面感的电影,比如<盗梦空间><操作系统革命><代码>等等, 再想想电影黑客帝国中的 ...

  10. css3写一个加载动画

    先制作一个正方形,让圆点在正方形的最外侧 <style> body { margin: 0; } .loading { width: 200px; height: 200px; backg ...