A single shortcut that changes text color in Notes?
When using Notes I often find myself changing the color of the text (usually to blue or red) as an additional way to indicate emphasis (alongside italics and bold).
The shortcut for displaying the available colors is Command-Shift-C but that still requires the user to use the mouse to click on a particular color.
Does anyone know how I can add a single shortcut that will switch to a given color and then, when pressed again, switch back to black? (So it, in effect, works the same way the italics and bold shortcuts work).
I don't need to make a shortcut for every color--one for blue would do just fine. Any ideas?
Solution 1:
This isn't exactly what you were asking for, but perhaps it is close enough.
Just below the menu place where you bring up the color picker (Format->Font->Show Colors) are two other menu items: Copy Style and Paste Style. This is what worked for me:
- Select some text in your note
- Manually set the color, like you do now (via Show Colors)
- Set the cursor anywhere inside the colored text (don't select any text, just put the cursor there)
- Choose Format->Font->Copy Style
- From now on (including across relaunches of the Notes app) you can select the text you want to color and simply use the keyboard shortcut for Paste Style!
Hope this works well enough for you.
Solution 2:
Here's how to change text colour in Notes.app with a single hotkey:
Setup:
Use this AppleScript code which performs the whole thing (this example is for red text):
set noteBody to "<body><p style=\"color:#FF0000;\" >styletext</p></body>"
tell application "Notes"
activate
tell default account to tell folder "Notes"
make new note with properties {body:noteBody}
end tell
end tell
tell application "Notes"
tell account "iCloud"
tell folder "Notes"
show note 1
end tell
end tell
end tell
delay 0.2
tell application "System Events"
key code 48 #Tab into the temporary note so we can 'Copy Style' from it
end tell
tell application "System Events" to tell process "Notes"
set frontmost to true
click menu item "Copy Style" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1
end tell
tell application "Notes"
tell account "iCloud"
tell folder "Notes"
delete note 1
end tell
end tell
end tell
tell application "System Events"
key code 50 using {command down} #Switch window back to working note with selected text
delay 0.2
end tell
tell application "System Events" to tell process "Notes"
set frontmost to true
click menu item "Paste Style" of menu 1 of menu item "Font" of menu 1 of menu bar item "Format" of menu bar 1
end tell
Then assign the AppleScript a hotkey such as with FastScripts.
The method:
- Open your working note in a standalone window by double-clicking on it.
- Select the text you want to give a colour.
- Press your FastScripts hotkey, and the colour is quickly applied.
Limitations:
Non-boldness of your hotkey style to paste will apply to bold text, so you'll need to not mix formatting together but set specific hotkeys for every combination of colour + formatting that you use.
Bonuses:
You can make as many colour hotkey as you want. In fact, due to the custom HTML in the AppleScript code, you could set any compatible colour + formatting combination, such as italics, bold, font size, highlight or text background, who knows what else.
E.g. for red bold it would be:
set noteBody to "<body><p style=\"color:#FF0000;\" >redtext</p></body>"
Helpful tips:
- This relies on you not customising Notes' menu item shortcuts from their defaults.
- This relies on you only having one main Notes window open and then another for the note you're working in.
- May have to customise other things in AppleScript according to how you use Notes, e.g. your chosen default account.
If anyone has improvements to this code or method, please contribute and I'll test it myself.