Skip to content

[Bug] Error converting color #529

@lolpowerluke

Description

@lolpowerluke

Before Reporting

  • I found no existing issues matching my bug
  • My issue is not caused by a theme
  • My issue is not caused by a plugin

Describe the Bug

When putting rgb/rgba/raw rgb in the colors.css (to have the colors tab in theme settings), I get the following error in console:

[59:02.583] ERROR Failed to evaluate script: {"argumentList":{"theme_name":"Minimal-Dark-for-Steam"},"methodName":"theme_config.get_color_opts","pluginName":"core"}. Error: invalid literal for int() with base 10: '1.00'Traceback (most recent call last):
  File "/usr/share/millennium/assets/core/themes/theme_config.py", line 237, in get_color_opts
    color["hex"] = convert_to_hex(get_config()[f"themes.themeColors.{theme_name}.{saved_color}"], ColorTypes(color["type"]))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/millennium/assets/core/themes/css_analyzer.py", line 71, in convert_to_hex
    values = [int(x.strip()) for x in color.split(',')]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/millennium/assets/core/themes/css_analyzer.py", line 71, in <listcomp>
    values = [int(x.strip()) for x in color.split(',')]
              ^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '1.00'

if I use raw rgba I get the following error instead:

[16:55.657] ERROR Failed to evaluate script: {"argumentList":{"theme_name":"Minimal-Dark-for-Steam"},"methodName":"theme_config.get_color_opts","pluginName":"core"}. Error: 'Minimal-Dark-for-Steam'Traceback (most recent call last):
  File "/usr/share/millennium/assets/core/themes/theme_config.py", line 233, in get_color_opts
    root_colors = self.colors[theme_name]
                  ~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'Minimal-Dark-for-Steam'

Along with no options in the colors tab, changing all colors to hex fixes this issue, but when I use hexa (with alpha channel, so 8 letters instead of 6 it ignores that variable and shifts all following variables up by 1

Expected Behavior

accept all supported formatting types listed on https://docs.steambrew.app/themes/intermediate/colors under formatting

Steps To Reproduce

1: create colors.css (with rootcolors option in skin.json)
2: add variable to colors.json (in rgb/rgba/raw rgb/raw rgba/hexa format)

Operating System

Linux

Anything else?

If you need more info, feel free to ask

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions