Skip to content

errors with tinted color schemes #5

@clach04

Description

@clach04

Inverse of #4 color schemes from https://github.com/tinted-theming/schemes fail to build

Ignoring instructions in #3 and making calls based on help output builder will crash with invalid integer errors. This appears to be due to code not expecting hex RGB prefixed with "#" (hash/pound) sign/symbol/character.

using https://github.com/tinted-theming/tinted-putty (instead of tinted terminal as the test case is smaller) and https://github.com/tinted-theming/schemes

python C:\code\terminal\base16_base24\tinted-builder-python\base24.py  --verbose --schemes-dir C:\code\terminal\base16_base24\tinted-theming_schemes\ --config templates\config.yaml

....
ERRO: C:\code\terminal\base16_base24\tinted-theming_schemes\base16\paraiso.yaml: ValueError("invalid literal for int() with base 16: '#2'")
ERRO: C:\code\terminal\base16_base24\tinted-theming_schemes\base24\wild-cherry.yaml: ValueError("invalid literal for int() with base 16: '#1'")
ERRO: C:\code\terminal\base16_base24\tinted-theming_schemes\base24\terminal-basic.yaml: ValueError("invalid literal for int() with base 16: '#f'")
ERRO: C:\code\terminal\base16_base24\tinted-theming_schemes\base16\brushtrees-dark.yaml: ValueError("invalid literal for int() with base 16: '#4'")
....

this seems to fix it

+++ b/base24_builder/builder.py
@@ -66,6 +66,8 @@ def format_scheme(scheme: dict, slug: str):

        all_bases = [f"base{x:02X}" for x in range(0, 24)]
        for all_base in all_bases:
+               if scheme[f"{all_base}-hex"].startswith('#'):
+                       scheme[f"{all_base}-hex"] = scheme[f"{all_base}-hex"][1:]
                # HEX and Reverse HEX
                scheme[f"{all_base}-hex-r"] = scheme[f"{all_base}-hex"][0:2]
                scheme[f"{all_base}-hex-g"] = scheme[f"{all_base}-hex"][2:4]

Although it does result in files with double dot/periods:

...
putty/base24-wild-cherry..reg
putty/base24-wombat..reg
putty/base24-wryan..reg
putty/base24-zenburn..reg

Which I think is another bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions