Skip to content

Error regenerating colorscheme #298

@cherrynoize

Description

@cherrynoize

wpg -R pink.png gives the following error:

Traceback (most recent call last):
  File "/sbin/wpg", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/__main__.py", line 305, in main
    process_args(args)
  File "/usr/lib/python3.11/site-packages/wpgtk/__main__.py", line 222, in process_args
    add_action(glob.glob(x)[0])
  File "/usr/lib/python3.11/site-packages/wpgtk/data/themer.py", line 24, in create_theme
    return color.get_color_list(filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 52, in get_color_list
    color_list = auto_adjust(color_list)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 150, in auto_adjust
    colors = smart_sort(colors)
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 130, in smart_sort
    closest_cds = [sorted_by_color[x][0] for x in range(8)]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 130, in <listcomp>
    closest_cds = [sorted_by_color[x][0] for x in range(8)]
                   ~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
[i] image         Using image pink.png.
[i] colors        Generating a colorscheme.
[i] colors        Using wal backend.
[i] colors        Generation complete.
Traceback (most recent call last):
  File "/sbin/wpg", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/__main__.py", line 305, in main
    process_args(args)
  File "/usr/lib/python3.11/site-packages/wpgtk/__main__.py", line 257, in process_args
    any(themer.reset_theme(arg) for arg in args.R)
  File "/usr/lib/python3.11/site-packages/wpgtk/__main__.py", line 257, in <genexpr>
    any(themer.reset_theme(arg) for arg in args.R)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/themer.py", line 77, in reset_theme
    return color.get_color_list(theme_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 52, in get_color_list
    color_list = auto_adjust(color_list)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 150, in auto_adjust
    colors = smart_sort(colors)
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 130, in smart_sort
    closest_cds = [sorted_by_color[x][0] for x in range(8)]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/wpgtk/data/color.py", line 130, in <listcomp>
    closest_cds = [sorted_by_color[x][0] for x in range(8)]
                   ~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

I did run wpg -a pink.png before that successfully, and after the error I can still set the wallpaper with wpg -s pink.png but it is using a previous colorscheme.

This only happens with pink.png and not (say) with black.png or other images in the directory, but I'm pretty sure this has happened after I ran optipng on the image to optimize it. Though I tried running optipng on an image which had not yet been set as wallpaper and it works fine with wpg. I must assume there's some issue because the image data has changed but I wouldn't know exactly how to solve this. I tried looking for and removing pink.png-ish files in ~/.config/wpg/ under schemes and wallpapers but still get the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions