Loading

Typora里面如何快捷改变字体颜色?

Typora里面如何快捷改变字体颜色?

1、常规文字变色方法:

  1. font 标签
<font color='red'>红色</font>
  1. span 标签
<span style='color:文字颜色;background:背景颜色;font-size:文字大小;font-family:字体;'>文字</span>

2、使用AutoHotKey(.ahk)快捷键变法 (Windows)

下载并安装 AutoHotkey(具体步骤可自行百度)

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

桌面新建文件 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中自动补全标签
    }
}
{
; alt+0 红色
    !0::addFontColor("black")
  
    ; alt+1 红色
    !1::addFontColor("red")

    ; alt+1 橙色
    !2::addFontColor("orange") 

     ; alt+3 黄色
    !3::addFontColor("yellow")

     ; alt+4 绿色
    !4::addFontColor("green")

    ; alt+5 浅蓝色
    !5::addFontColor("cornflowerblue")

     ; alt+6 青色
    !6::addFontColor("cyan") 

   ; alt+7 紫色
    !7::addFontColor("purple")

}

双击运行(使用AutoHotkey运行)

运行脚本

  1. 双击ahk脚本运行

  2. Typora检测

    1. Ctrl+Alt+O——橙色Orange

    2. Ctrl+Alt+R——红色Red

    3. Ctrl+Alt+B——蓝色Blue

然后去Typora 按快捷键试试吧!!!

选择要设置颜色的文字,按Ctrl+Alt+o添加橙色,按Ctrl+\取消样式!

更多功能可以自行查看:https://www.zhihu.com/question/385854845/answer/1182275415

posted @ 2021-01-07 20:02  就学45分钟  阅读(3332)  评论(0编辑  收藏  举报