V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
mobpsycho100
V2EX  ›  Alfred

改变 Notes 的字体颜色

  •  
  •   mobpsycho100 · 2022-01-30 22:06:58 +08:00 · 1264 次点击
    这是一个创建于 787 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Notes 是一个很好用的富文本编辑器, 但是缺少 markdown 的一些实用的特性, 例如 code block 和 math mode. 为了在 notes 中模仿 (inline) code block 功能, 我们可以用紫色字体来写代码. 这个 AppleScript 提供了切换字体颜色的功能, 需要配合 Alfred 在 notes 激活的情况下使用(例如绑定快捷键 cmd+shift+c).

    预设: 打开 Notes-Format-Font-Show Colors, 切换到 Color Palettes, 设置底部的第一个和第二个快捷颜色(例如黑色和紫色). 下方的 AppleScript 将修改字体颜色 (例如将黑色变为紫色, 或者反过来).

    tell application "System Events"
    	repeat while not (exists window "Colors" of application process "Notes")
    		try
    			click menu item "Show Colors" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1 of application process "Notes"
    		end try
    	end repeat
    	
    	click UI element 3 of toolbar 1 of window "Colors" of application process "Notes"
    
    	set currentColor to value of color well 1 of splitter group 1 of window "Colors" of application process "Notes"
    	
    	set color1 to value of color well 1 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
    	
    	set color2 to value of color well 2 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
    	
    	
    	if (currentColor = color1) then
    		click color well 2 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
    	else
    		click color well 1 of list 1 of list "favorite swatches" of scroll area 2 of splitter group 1 of window "Colors" of application process "Notes"
    	end if
    	
    	
    	repeat while (exists window "Colors" of application process "Notes")
    		try
    			click menu item "Hide Colors" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1 of application process "Notes"
    		end try
    	end repeat
    	
    end tell
    
    1 条回复    2022-01-31 12:18:16 +08:00
    keleo030
        1
    keleo030  
       2022-01-31 12:18:16 +08:00 via iPad
    感谢分享,听上去有点麻烦。用 notes 的人估计也不多,不过我是 notes 的忠实铁粉,配合 applepencil 体验真不错。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3256 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:54 · PVG 19:54 · LAX 04:54 · JFK 07:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.