diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 9b610ef4f1..958e9fc2f5 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -66,6 +66,10 @@ SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) : // create the common settings shared by all applications. Not loaded immediately m_common_settings = RegisterSettings( new COMMON_SETTINGS, false ); + + // Create the built-in color settings + // Here to allow the Python API to access the built-in colors + registerBuiltinColorSettings(); } SETTINGS_MANAGER::~SETTINGS_MANAGER() @@ -305,11 +309,17 @@ COLOR_SETTINGS* SETTINGS_MANAGER::GetMigratedColorSettings() } +void SETTINGS_MANAGER::registerBuiltinColorSettings() +{ + for( COLOR_SETTINGS* settings : COLOR_SETTINGS::CreateBuiltinColorSettings() ) + m_color_settings[settings->GetFilename()] = RegisterSettings( settings, false ); +} + + void SETTINGS_MANAGER::loadAllColorSettings() { // Create the built-in color settings - for( COLOR_SETTINGS* settings : COLOR_SETTINGS::CreateBuiltinColorSettings() ) - m_color_settings[settings->GetFilename()] = RegisterSettings( settings, false ); + registerBuiltinColorSettings(); wxFileName third_party_path; const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables(); diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index 69128e138e..c1d8779493 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -414,6 +414,9 @@ private: */ bool unloadProjectFile( PROJECT* aProject, bool aSave ); + // Helper to create built-in colors and register them + void registerBuiltinColorSettings(); + private: /// True if running outside a UI context