Skip to content

Conversation

@Jonius7
Copy link

@Jonius7 Jonius7 commented Aug 22, 2025

RGBA needs an extra float() conversion on line 73 of css_analyzer.py.

@shdwmtr
Copy link
Member

shdwmtr commented Aug 22, 2025

RGBA format does not support float types. Its a 4 byte data type where each byte, containing 8 bits, can represent 0-255 (2^8-1). I'm not quite following the reasoning here.

@Jonius7
Copy link
Author

Jonius7 commented Aug 23, 2025

The a value is a float between 0 - 1

If you try to use a rgba color value eg: with 0.5 as the a value you get this error:

[18:11.989] CORE Error in theme config change: invalid literal for int() with base 10: '0.5'
Traceback:
Traceback (most recent call last):
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\theme_config.py", line 48, in on_config_change
    self.setup_theme_hooks()
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\theme_config.py", line 271, in setup_theme_hooks
    self.setup_colors()
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\theme_config.py", line 200, in setup_colors
    self.colors[theme['native']] = json.loads(parse_root(root_colors))
                                              ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\css_analyzer.py", line 208, in parse_root
    result = generate_color_metadata(root_component, property_map)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\css_analyzer.py", line 185, in generate_color_metadata
    "defaultColor": convert_to_hex(value, type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\css_analyzer.py", line 73, in convert_to_hex
    values = [int(x.strip()) for x in color[color.index('(')+1:-1].split(',')]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files (x86)/0E Games/Steam/ext/data/assets/core\themes\css_analyzer.py", line 73, in <listcomp>
    values = [int(x.strip()) for x in color[color.index('(')+1:-1].split(',')]
              ^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '0.5'

You use float() on line 81 as well
That being said, line 71 also needs to be changed since it is converting raw RGBA

@shdwmtr
Copy link
Member

shdwmtr commented Aug 23, 2025

Ah okay I see, thanks. CSS apparently uses an unconventional RGBA format. They represent the alpha byte as float!

@shdwmtr shdwmtr self-assigned this Aug 23, 2025
@shdwmtr shdwmtr added the bug Something isn't working label Aug 23, 2025
@shdwmtr
Copy link
Member

shdwmtr commented Aug 23, 2025

For clarification, what does your color config file look like? Millennium doesn't support customizing alpha values, it was a limitation with and I never got around to adding a better color picker.
{25F0243A-A56D-4627-88EB-3E224F49F74C}

@Jonius7
Copy link
Author

Jonius7 commented Aug 24, 2025

I did take out the rbga value and used color-mix in my CSS instead

But the value I had was something like

--mycolor: 53, 56, 79, 0.5

@shdwmtr
Copy link
Member

shdwmtr commented Aug 24, 2025

I might not merge this for now then if its a non-issue, I don't want to break anything. I'll keep this open though; if I ever add alpha support I'll add it to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants