Add backgrounds to finish layout tutorial, add inline and remote CSS support with a default of browser.css which currently supports fonts and backgrounds

This commit is contained in:
csd4ni3l
2025-07-21 12:29:32 +02:00
parent a604a5dbd1
commit 09c1ce7f5a
8 changed files with 460 additions and 127 deletions

View File

@@ -63,3 +63,23 @@ class FakePyPresence():
...
def close(self, *args, **kwargs):
...
def hex_to_rgb(hex_color):
hex_color = hex_color.lstrip('#')
if len(hex_color) != 6:
return (127, 127, 127)
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
def get_color_from_name(rgb_name):
rgb_name = rgb_name.upper()
if rgb_name.startswith("LIGHT"):
color_name = rgb_name.split("LIGHT")[1]
color_value = arcade.csscolor.__dict__.get(f"LIGHT_{color_name}")
if not color_value:
arcade.color.__dict__.get(f"LIGHT_{color_name}")
if color_value:
return color_value
color_value = arcade.csscolor.__dict__.get(rgb_name)
return color_value if color_value else arcade.color.__dict__.get(rgb_name, arcade.color.GRAY)