def create_ready_theme(syntax_name, default_text_settings):
    """Create and return a theme by merging text settings.

    That is, we merge general settings with the highlighting
    settings for the syntax to be used (such highlight
    settings are several text settings for different
    kinds of words/text in a specific syntax).

    For instance, in the Python syntax, the highlight
    settings include settings for several kinds of text
    like keywords, built-in functions, etc. Each of these
    groups have specific settings assigned to them in the
    json file for the theme.

    But instead of starting from such specific settings,
    each kind of text starts with the general settings and
    only them we override such settings with the specific
    settings for that group.

    Before using the specific settings, we also assign the
    background color from the theme to the general settings.

    Why not just use the specific settings, then? Because
    the general settings as well as the background color
    represent default values for specific settings that may
    not be present in the specific settings, thus serving as
    a base.

    This is specially important for settings not defined
    on the theme, like font height, which is something
    that usually depends on where the text will be used
    which is why it is not defined on the theme.

    Parameters
    ==========
    syntax_name (string)
        represents the syntax for which the highlighting
        settings will be retrieved.
    default_text_settings (dict)
        text settings to use as defaults for values not
        specified in the highlighting settings.
    """
    ### retrieve the raw theme
    raw_theme = RAW_THEMES_MAP[syntax_name]

    ### retrieve the text settings and background
    ### color from the raw theme

    theme_text_settings = raw_theme["text_settings"]
    background_color = raw_theme["background_color"]

    ### create a new merged settings map by merging
    ### the different text and background settings;
    ### settings with lower priority are merged first,
    ### so those with higher priority can override
    ### them as they are merged into the dict

    merged_settings_map = {
        ## this new dict map each kind of highlighted
        ## text to a dict
        kind_of_text: dict(
            ## the dict is built with the following items:
            ##
            ## 1) the items from the general text settings;
            ## 2) the background color defined for the theme;
            ## 3) the items from the specific settings;
            (
                *default_text_settings.items(),
                ("background_color", background_color),
                *specific_settings.items(),
            )
        )
        ## we grab the kind_of_text (a string) and highlight
        ## settings (a dict) from the theme text settings map
        for kind_of_text, specific_settings in theme_text_settings.items()
    }

    ### now return a new dict with the background of the
    ### raw theme and the new merged settings as the
    ### 'text_settings';
    ###
    ### this dict represents the theme ready for usage

    return {"background_color": background_color, "text_settings": merged_settings_map}
Create and return a theme by merging text settings.

    That is, we merge general settings with the highlighting
    settings for the syntax to be used (such highlight
    settings are several text settings for different
    kinds of words/text in a specific syntax).

    For instance, in the Python syntax, the highlight
    settings include settings for several kinds of text
    like keywords, built-in functions, etc. Each of these
    groups have specific settings assigned to them in the
    json file for the theme.

    But instead of starting from such specific settings,
    each kind of text starts with the general settings and
    only them we override such settings with the specific
    settings for that group.

    Before using the specific settings, we also assign the
    background color from the theme to the general settings.

    Why not just use the specific settings, then? Because
    the general settings as well as the background color
    represent default values for specific settings that may
    not be present in the specific settings, thus serving as
    a base.

    This is specially important for settings not defined
    on the theme, like font height, which is something
    that usually depends on where the text will be used
    which is why it is not defined on the theme.

    Parameters
    ==========
    syntax_name (string)
        represents the syntax for which the highlighting
        settings will be retrieved.
    default_text_settings (dict)
        text settings to use as defaults for values not
        specified in the highlighting settings.
    
nodezator/syntaxman/utils.py