Friday, March 11, 2016

How to theme and change the font of the Arduino IDE (Tutorial)

You've probably had this problem before; Writing code late at night trying to get new features to work but the bright white of the default IDE is burning your eyes and giving you a headache even with F.Lux installed, and/or you've mistaken a "l" for a "1". Well, there are solutions to those problems, but not the other well known problems (autocomplete, not enough debugging features, etc etc) after the break.
Original on left, rethemed and refonted on right

Orange font is Windows specific, Yellow is OSX
First thing you'll need to do is close the IDE then download the Dark Theme by Jeff Thompson from GitHub, navigate to the folder in C:\Program Files (x86)\Arduino\lib ~/Applications/Arduino.app/Contents/Java/librename the existing theme folder to "Theme_orig" then paste in the new theme from the Git zip file.

Modified folder with Themes

After that, pick out a new font! I'm using the basic version of Input which is a coding-designed font in my IDE. Once you've got the TTF files, place them down alongside the existing fonts in the folder C:\Program Files (x86)\Arduino\java\lib\fonts ~/Applications/Arduino.app/Contents/Java/lib/fonts Once that is done, change the preferences file to match the new font which is found at C:\Users\youruser\AppData\Local\Arduino15  User/Library/Arduino,  specifically the "editor.font" line, to which you change the default Monospaced to whatever your font is (CASE SENSITIVE). Finally save the modification, start your IDE and enjoy the new feel! 
Font files
Line to edit
Example of Input font in use (Looks way better than Monospaced)

14 comments:

  1. I can't get font to change. I even renamed it exactly to what you have.

    ReplyDelete
    Replies
    1. That's odd, did you follow the tutorial exactly? Uppercased the first letter?

      Delete
  2. Nice job, and thanks. I'd like even higher contrast, though, so how would I change the text to full white and the background to full black?

    ReplyDelete
    Replies
    1. change color definitions in theme.txt (in the themes dir) from everything else to WHITE.
      The colors are helpful though..

      Delete
  3. Where can I get those inputs? the link you wrote?

    ReplyDelete
  4. Great article! It worked pretty well with Arduino IDE 1.6.12.

    For Linux users, assuming the IDE version above installed with the official package from arduino.cc (and not from your distro package repositories): the preferences file will be located at ~/.arduino15 just in case you are wondering and the themes directory will not be under java/lib but under /lib instead.

    ReplyDelete
  5. Works perfectly! Good job man!

    ReplyDelete
  6. Works like a charm, and no more eye strain. Thank you!

    ReplyDelete
  7. cant get Operator Mono to work, otherwise works perfect

    ReplyDelete
  8. IS THERE A WAY TO CHANGE IT TO OTHER FONTS TOO?

    ReplyDelete
  9. It took me a long time to find the answer for using Roboto Mono font. Only here I found the answer: copy the font to the lib/fonts/ folder. Thank you very much!

    ReplyDelete