From BlenderWiki

Jump to: navigation, search

Adding a New Theme Color

This checklist covers the places you need to edit to add a new theme color.

  • It DOES cover the full list of places where edits may be needed
  • It DOES NOT cover whether adding yet another option is a good idea. Please consult the core dev team on #blendercoders or via any of the usual channels before committing to any substantial dev efforts here.
  • It DOES NOT cover adding another "UI" (widgets, panels, generic stuff) theme colour, which should be covered in another checklist instead. The basics though are pretty similar (same files, just different structs/sections of code)
  • It DOES NOT cover how you should go about choosing the most awesome color yet, that fits in harmony with the universe, etc. etc.


Checklist

SDNA:

  • Define property storage in one of the theme color structs

Identifier Define + Binding:

  • Define an identifier to use for accessing that color (editors/include/UI_resources.h - e.g. TH_MY_NEWCOLOR)
  • Bind the identifier to the underlying property used (editors/interface/resources.c - UI_ThemeGetColorPtr - look for the case TH_BLAH: cp = ts->blah; break; lines

Defaults + Version Patching (editors/interface/resources.c):

  • Set colours for this, as used in default theme - ui_theme_init_defaults() - Do this for all editor types where the colour is needed
  • Add version patching code in init_userdef_do_versions() (using same values as before), or else everyone using custom themes will complain of seeing black all over


RNA

  • Add RNA properties for the new colours - makesrna/intern/rna_userdef.c