I see that "Syntax highlighting" is loading default colors from XML files in \share\CodeBlocks\lexers.
A lexer for each language has color presets inside, and if I switch around fg and bg values in lexer_cpp.xml or other files, file the colors will indeed be reversed.
However, I don't see an option to create multiple themes inside of the XML files:
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_lexer_properties>
<CodeBlocks_lexer_properties>
<Lexer name="C/C++"
index="3"
filemasks="*.c,*.cpp,*.cc,*.cxx,*.h,*.hpp,*.hh,*.hxx,*.inl,*.ipp,*.tcc,*.tpp">
<Style name="Default"
index="0,11"
fg="255,255,255"
bg="0,0,0"
bold="0"
italics="0"
underlined="0"/>
<Style name="Default (inactive)"
index="64,72,75"
fg="200,200,200"/>
<Style name="Comment (normal)"
index="1,23"
fg="152,152,217"/>
So modifying lexer files would change everything to dark mode only.
If I want to give the ability to change color theme, I need to add that color theme into default.conf file:
<editor>
<colour_sets>
<default />
<default_dark_mode>
<NAME>
<str>
<![CDATA[default_dark_mode]]>
</str>
</NAME>
<cc>
<style0>
<FORE>
<colour r="233" g="233" b="233" />
</FORE>
<BACK>
<colour r="7" g="7" b="7" />
</BACK>
<NAME>
<str>
<![CDATA[Default]]>
</str>
</NAME>
</style0>
<style1>
<FORE>
<colour r="233" g="233" b="233" />
</FORE>
<BACK>
<colour r="7" g="7" b="7" />
</BACK>
<NAME>
<str>
<![CDATA[Default]]>
</str>
</NAME>
</style1>
<NAME>
<str>
<![CDATA[C/C++]]>
</str>
</NAME>
</cc>
</default_dark_mode>
<ACTIVE_COLOUR_SET>
<str>
<![CDATA[default_dark_mode]]>
</str>
</ACTIVE_COLOUR_SET>
<ACTIVE_LANG>
<str>
<![CDATA[C/C++]]>
</str>
</ACTIVE_LANG>
</colour_sets>
But the default.conf file is created only after the first launch of CodeBlocks. What would be the best way to add a new in-built colour theme, which would be visible even without altering the default.conf file?
I see that editorcolourset.cpp contains this, still wondering how to deal with it:
EditorColourSet::EditorColourSet(const wxString& setName)
: m_Name(setName)
{
LoadAvailableSets();
if (setName.IsEmpty())
m_Name = COLORSET_DEFAULT;
else
Load();
}
You can test something like this when loading from the lexer
wxColor fg = LoadFromLexer(FOREGROUND);
wxColor bg = LoadFromLexer(BACKGROUND);
if (DarkMode)
{
fg.SetRGBA(fg.GetRGBA() ^ 0x00FFFFFF);
bg.SetRGBA(bg.GetRGBA() ^ 0x00FFFFFF);
}
inverting them again when saving.
Reading your modifications in C::B code, I think you should guard them at least in wxscolourproperty.cpp :
#if wxCHECK_VERSION(3, 3, 0)
#define wxPG_FL_IN_HANDLECUSTOMEDITOREVENT 0x00080000
#endif // wxCHECK_VERSION
because the value is not the same in wxWidgets 3.2.3 (or 3.2.4), and with those previous official wxWidgets versions, the compiler has no problems to find it in propgrid.h. I have until now no idea why this value is not found correctly with wxWidgets 3.3.0.
May be you can also guard inclusion of wx/hashmap.h in wxsitemeditorcontent.h, but it's probably not very useful.
#if wxCHECK_VERSION(3, 3, 0)
#include <wx/hashmap.h>
#endif // wxCHECK_VERSION