Make menuconfig colors configurable

Closes https://github.com/espressif/esp-idf/issues/4387
This commit is contained in:
Roland Dobai 2019-11-22 15:05:46 +01:00
parent a3b47da377
commit bd2fc9f832
4 changed files with 32 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,