Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Theme Structure #1051

Merged
merged 12 commits into from
Jul 3, 2021
Merged

Improve Theme Structure #1051

merged 12 commits into from
Jul 3, 2021

Commits on Jul 3, 2021

  1. color: Add helper function to new file to add color properties.

    A helper function `color_properties` was used to make it easy to add
    color definitions with style properties. It was added into
    config/color.py to avoid circular imports in `themes.py`.
    
    Tests added.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    028853c View commit details
    Browse the repository at this point in the history
  2. color: Add default color-scheme with bold, based on existing colors.

    A DefaultColor class is added to color.py which acts as the default
    color-scheme for ZT. The BOLD property is added to these colors
    using the helper function color_properties.
    
    The format:
    * The colors have been defined using Enum's as a single string
    containing 16, 256 and 24 bit codes.
    * Each style is defined as a tuple of 2 elements, the foreground
    and the background.
    
    The 24 bit colors are not defined for the default colors hence
    default is used. 2 missing colors in DEF, DARK_MAGENTA and
    LIGHT_CYAN, which were used in zt_blue were added into Color.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    d31e7ca View commit details
    Browse the repository at this point in the history
  3. themes: Rename required_styles to REQUIRED_STYLES for consistency.

    The `required_styles` dict is renamed to REQUIRED_STYLES to maintain
    similarity with STYLE dict in incoming themefiles.
    
    Tests updated.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    923f2eb View commit details
    Browse the repository at this point in the history
  4. THEME_CONTRIBUTING: Add documentation for creating/adapting themes.

    This commit creates a Theme Contribution Guide to help with
    understanding the format in Themefiles and creating new themes.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    91af6d9 View commit details
    Browse the repository at this point in the history
  5. zt_dark: Create new zt_dark theme structure.

    New zt_dark theme structure was created using a script and
    some manual editing. `zt_dark.py` can be found in the new themes folder.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    1873e0e View commit details
    Browse the repository at this point in the history
  6. zt_light: Create new zt_light theme structure.

    New zt_light theme structure was created using a script and
    some manual editing. `zt_light.py` can be found in the themes folder.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    8b15e5f View commit details
    Browse the repository at this point in the history
  7. zt_blue: Create new zt_blue theme structure.

    New zt_blue theme structure was created using a script and
    some manual editing. `zt_blue.py` can be found in the themes folder.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    c71c172 View commit details
    Browse the repository at this point in the history
  8. gruvbox: Create new gruvbox theme structure.

    New gruvbox theme structure was created using a script and
    some manual editing. `gruvbox.py` can be found in the themes folder.
    The names used for the color scheme is from the official gruvbox
    theme.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    d1ffd63 View commit details
    Browse the repository at this point in the history
  9. themes: Test new themefile completeness.

    This commit tests completeness on new themefiles in test_themes.
    Checks:
    * STYLE and REQUIRED_STYLES use the same styles
    * All 3 color codes are in the correct format, using regex
    * color used in STYLE is defined in the Color class.
    
    Run: pytest -k test_new_builtin_theme
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    00a1e5d View commit details
    Browse the repository at this point in the history
  10. themes: Parse theme file to generate urwid theme.

    This commit creates the function `generate_theme` in themes.py
    which parses a theme file to generate a urwid compatible theme
    depending on the color-depth used.
    
    The theme files are accessed using NEW_THEMES which is a placeholder
    for the THEMES dict until migration happens.
    
    A new type hint for urwid compatible styles is created - StyleSpec.
    
    Slicing lists doesn't work with very specific type hints like
    StyleSpec hence Any is used, though this function will shortly be
    removed.
    
    Tests added.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    91a5375 View commit details
    Browse the repository at this point in the history
  11. tests: theme: Test migration to new themes.

    A temporary test has been used to make sure all the color codes for all
    the color depths are correct and no errors have been made during the
    transition.
    
    Run: `pytest -k test_migrated_themes`
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    a609ec4 View commit details
    Browse the repository at this point in the history
  12. theme: Delete old themes and migrate to new themefiles.

    Old theme format used in themes.py is deleted from this commit.
    * Migrated to new themes in `run.py`
    * Mono theme generation is no longer required hence it is removed
    from both themes.py and run.py
    * NEW_THEMES is now the new THEMES dict.
    * `complete_and_incomplete_themes` is edited to make it use the
    new THEMES instead of the old one.
    
    A new `builtin_theme_completeness` test is added.
    
    Tests amended.
    Rohitth007 authored and neiljp committed Jul 3, 2021
    Configuration menu
    Copy the full SHA
    f1a3adf View commit details
    Browse the repository at this point in the history