5

I am interested in adding a hotkey to change the color of a text. I edit, so switching text from black to red is something I do often, but I have to go click on text color each and every time in Google Docs.

Is there any way to actually add new hotkeys in Google Docs? So far it seems like it's not an available option.

1

No, so far this functionality has not beed added, even though it has been requested for several years now. I have exactly the same issue as you (I am a researcher and use red, blue, green and black when making notes on different aspects of research. These days, when making notes, I just use Microsoft on work PC. The best workaround I have found is to change the 'Default Styles' of each of the Syle dropdown box - I made 'Heading 1' normal sized text but red, Heading 2 is blue and so on. To switch between styles, you can use CTRL + 7/8/9/0.

  • Thanks that's a great idea, I'm definitely going to use the header trick. Double thanks!!!! – Ashley Weaver Aug 14 '15 at 2:22
1

Solution 1 (best to change the fonts and simple stuff): Just install the extension TamperMonkey and use/improve this script



Solution 2 (Depreciated): I first tried using a google script, but it was just too slow (useless).

Solution 3 (for Windows): using autohotkey (best for all the things your can't do with the first solution)

AutoHotkey (free, open-source) will automatically move the mouse, and click wherever you want. [EDIT: To change the font, it's easier to just go with the first solution. But for other stuff (like changing the font size) I was not able to use tampermonkey. It's easy to do it using autohotkey.]

The code below will rotate the font color just by moving the mouse, getting the pixel color or clicking on stuff: if it's black it will set it to dark blue, if it's dark blue, it'll set it to light blue, if it's light blue set it to red, else it'll set it to black. enter image description here

Since the code works with the "mouse position" which changes according to the size of your screen to make it work for you, you simply need to replace the mouse position in the code below. To do that you will need the "windows spy tool" (you will get it when you will install AutoHotkey).

Then just place your mouse where you need to get the mouse position and copy the 2 numbers given after "relative" (360, 105 in the screenshot)

screenshot


PS:

  • You can delete the part with the fullscreen if you don't use it.

  • Switching to fullscreen might take more time if your CPU is slower. If this is the case just increase the waiting time (add in the code a sleep 1000 after the f11 line).

  • don't forget to update the mouse position when google doc update its features (the position of the button change sometime).

  • Be very careful with the comments (; blah blah). Eg: don't put them behind "click" it creates weird bugs)

code:


#IfWinActive  ahk_exe chrome.exe ; shortcut'll only work on chrome 

!w::
; you can use any shortcut. Syntax: Alt(!) CTRL(^) shift(+) win(#) 

; check if it's fullscreen or not
PixelGetColor ColorWin, 1357, 6 RGB  
if (ColorWin!="0xFFFFFF")   ; if the top right of your screen isn't white, fullscreen is OFF: so press f11 to turn ON the fullscreen
    send {f11} 

; get the color of the font (shown below the font button)
PixelGetColor ColorText, 614, 90 RGB  
; msgbox, 64, , (%ColorText%)   ; uncomment to debug (it will give you the color in a message box)
; sleep 100 

;if it's black: click on dark blue
    ; click 1 is on the font button
    ; click 2 on the "text" tab
    ; click 3 on the color

if (ColorText="0x000000" or ColorText="0xF2F2F2") {   
    click,614, 84 
    click,660, 118
    click,750, 182 
} 

;if it's dark blue: clik on light blue
else If (ColorText="0xFF0000") { 
    click,614, 84
    click,660, 118
    click,732, 183 
}

;if it's light blue, clik on red
 else IF (ColorText="0xE8864A") { 
    click,614, 84
    click,660, 118
    click,641, 179 
}

; else click on black
else 
{
    click,614, 84
    click,660, 118
    click, 624, 160
}

return

#IfWinActive ; reset winactive
  • This is a great suggestion. AutoHotKey is so powerful once you are familiar with its capabilities. – Robyn Sep 13 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.