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.