diff --git a/docs/en/get-started/index.rst b/docs/en/get-started/index.rst index 10b10c74b..837f2ebff 100644 --- a/docs/en/get-started/index.rst +++ b/docs/en/get-started/index.rst @@ -321,6 +321,11 @@ If the previous steps have been done correctly, the following menu appears: Project configuration - Home window +.. note:: + + The colors of the menu could be different in your terminal. You can change the appearance with the option + ``--style``. Please run ``idf.py menuconfig --help`` for further information. + To navigate and use ``menuconfig``, press the following keys: * Arrow keys for navigation diff --git a/make/project_config.mk b/make/project_config.mk index e9563092f..73369ebae 100644 --- a/make/project_config.mk +++ b/make/project_config.mk @@ -99,10 +99,12 @@ define RunConfGen $1 endef +export MENUCONFIG_STYLE ?= aquatic + ifeq ($(OS),Windows_NT) MENUCONFIG_CMD := $(KCONFIG_TOOL_DIR)/mconf-idf else -MENUCONFIG_CMD := MENUCONFIG_STYLE=aquatic $(PYTHON) $(IDF_PATH)/tools/kconfig_new/menuconfig.py +MENUCONFIG_CMD := $(PYTHON) $(IDF_PATH)/tools/kconfig_new/menuconfig.py endif # macro for running menuconfig diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index b12e4f309..17488bc38 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -255,7 +255,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) set(MENUCONFIG_CMD ${mconf}) else() - set(MENUCONFIG_CMD "MENUCONFIG_STYLE=aquatic" ${python} ${idf_path}/tools/kconfig_new/menuconfig.py) + set(MENUCONFIG_CMD ${python} ${idf_path}/tools/kconfig_new/menuconfig.py) endif() # Generate the menuconfig target diff --git a/tools/idf_py_actions/core_ext.py b/tools/idf_py_actions/core_ext.py index fc646d591..03a52377e 100644 --- a/tools/idf_py_actions/core_ext.py +++ b/tools/idf_py_actions/core_ext.py @@ -30,6 +30,14 @@ def action_extensions(base_actions, project_path): ensure_build_directory(args, ctx.info_name) run_target(target_name, args) + def menuconfig(target_name, ctx, args, style): + """ + Menuconfig target is build_target extended with the style argument for setting the value for the environment + variable. + """ + os.environ['MENUCONFIG_STYLE'] = style + build_target(target_name, ctx, args) + def fallback_target(target_name, ctx, args): """ Execute targets that are not explicitly known to idf.py @@ -236,9 +244,22 @@ def action_extensions(base_actions, project_path): ], }, "menuconfig": { - "callback": build_target, + "callback": menuconfig, "help": 'Run "menuconfig" project configuration tool.', - "options": global_options, + "options": global_options + [ + { + "names": ["--style", "--color-scheme", "style"], + "help": ( + "Menuconfig style.\n" + "Is it possible to customize the menuconfig style by either setting the MENUCONFIG_STYLE " + "environment variable or through this option. The built-in styles include:\n\n" + "- default - a yellowish theme,\n\n" + "- monochrome - a black and white theme, or\n" + "- aquatic - a blue theme.\n\n" + "The default value is \"aquatic\". It is possible to customize these themes further " + "as it is described in the Color schemes section of the kconfiglib documentation."), + "default": os.environ.get('MENUCONFIG_STYLE', 'aquatic'), + }], }, "confserver": { "callback": build_target,