Skip to content

[IDE] Add support for user-defined theme in sketchbook folder #7115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Mumfrey
Copy link
Contributor

@Mumfrey Mumfrey commented Jan 11, 2018

Summary

This pull request provides a small enhancement to the way themes are handled within the IDE, providing support for a user-defined theme folder placed in the sketchbook folder to override elements in the internal theme folder.

Description

This small change provides the following features:

  • Allows user-defined theme changes to be persisted across IDE versions, in particular if the user only wishes to customise a single element of the IDE this becomes much easier, example below.
  • Correspondingly, provides a possible fix for RFE: move theme.txt from application folder on Mac #7013
  • Makes it possible for third parties to provide prepackaged themes which can be installed without needing to overwrite the original theme resources in the application directory. (Possible enhancement, support prepackaged themes in a zip file in the same location, such as <sketchbook>/theme/theme.zip. I'd be happy to add this if there's any interest.)
  • Normally theme image resources are preferentially selected .svg first and .png otherwise. This PR preserves this relationship within a theme type, but a .png resource in a user-defined theme can still override an .svg resource in the default theme.
  • Resources which normally reside in the lib folder directly are first checked in the user-defined theme folder,
  • Themes can specify the editor.font property if a user-defined theme wishes to customise the font, however the custom font is not applied if the user has already defined a non-standard font in their preferences.txt. This is intended so that third-party theme designers can specify an editor font as part of their theme but previous user preferences will still take precedence.

Examples

  • Installing this dark theme can be achieved by downloading or cloning the repo and simply placing the theme folder inside the arduino sketch folder:

    Jeff Thompson's Dark Theme

  • Simple customisations can be applied on top of the default theme by creating a theme.txt with only the required customised settings. For example this barebones theme.txt:

    # editor font - only overrides if not configured by user in preferences.txt
    editor.font = Consolas,plain,12
    
    # foreground and background colors
    editor.fgcolor = #000000
    editor.bgcolor = #c5edee
    
    # TEXT - COMMENTS
    editor.comment1.style = #990000,plain
    editor.comment2.style = #990000,plain

    Results in the following customised theme output:

    Minimal customisation example

    This is intended to provide users with a simple way to customise only a few theme elements (eg. comment colour) without needing to take a kitchen sink approach or have to continually re-apply their specific settings when upgrading to new versions of the IDE.

Notes

  • This is my first pull request to your repo, so I apologise in advance if I have inadvertently violated any style guidelines and will happily rectify any issues. I did consult the contribution guidelines before submitting this PR.
  • I have submitted this against 1.9-beta but if you would like a submission against master for integration in 1.8.6 then I'm happy to do that, though I assumed that since this is a mainly cosmetic piece of functionality that the beta would be a more sensible target.
  • If this PR is the kind of thing you're looking for, I would be happy to work on an integrated or external theme editor of some kind which would allow users to design and customise their own themes more easily.

Thanks for your time and consideration.

@facchinm facchinm self-requested a review January 12, 2018 08:50
@facchinm facchinm self-assigned this Jan 12, 2018
@facchinm facchinm added Component: IDE user interface The Arduino IDE's user interface IDE 1.9.x Beta Related to the Arduino IDE Beta Build feature request A request to make an enhancement (not a bug fix) labels Jan 12, 2018
@facchinm
Copy link
Member

Hi @Mumfrey ,
I really like this PR. Thanks you so much for taking time to tackle this problem.
Being able to add the theme as a zip would be awesome; in the meantime I'm going to merge it on beta-1.9.x so it will be soon available on https://www.arduino.cc/en/Main/Software#beta for further testing.
Thanks again!

@lmihalkovic
Copy link

Cool ... packaged the example as a zip

@animeshsrivastava24
Copy link

@per1234
As mentioned in #6454 regarding two methods for easier accessing the Arduino IDE Theme:

  1. Creating a GUI Theme Editor (either a standalone application or added to File > Preferences.)
  2. Document the location of the theme files and the function and various properties (adding it as a page on the Github Wiki).

Also as the mentioned work goes in the #7115, I would like to work on following topics and produce the result as a PR.

  1. Designing a theme editor for the Arduino as mentioned in the Option 1 above
  2. Documenting each part of the text in the file .arduino/preference.txt
  3. Creating a user-guide for the same that can be published as an article- the features of the user-guide will be more like a book with chapters moving from top to bottom of the GUI of the arduino and indicating the methods to change each part and features in detail with help of Proper Color Format and patterns

Should I open it as an Issue(Work) with the Name: "GUI Theme Editor and Documentation".
Please guide.
Also, will it be more like a technical writing part, I am newbie to open source and learning a lot from this Community.

@per1234
Copy link
Collaborator

per1234 commented May 29, 2019

@animeshsrivastava24 these topics are more appropriate for discussion in #6454 so I have responded there: #6454 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface feature request A request to make an enhancement (not a bug fix) IDE 1.9.x Beta Related to the Arduino IDE Beta Build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants