Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished aliasing modifications & merged theme changes/ #111

Merged
merged 4 commits into from
Sep 8, 2024

Conversation

Inverted-E
Copy link
Contributor

Ref #101

I had to modify configure.py as it would throw an exception when trying to build themes other than dark-blue and light-blue. The code for aliasing expected them to exist even if not requested. Now it'll only build the alias(es) if dark-blue and/or light-blue are in args.styles.

Changed -alt themes to

    "view:hover": "",

instead of

    "view:hover": "None",

This produces the same result.

Using "passthrough" or "transparent" does the opposite of what was desired, see screenshots below.

Using "none" or "" (desired effect):

none or

Using "transparent":

transparent

Using "passthrough":

passthrough

= added 4 commits September 7, 2024 23:23
…-blue or light-blue themes not to be built. Merged changes to themes to include extension specific lines
@Alexhuszagh
Copy link
Owner

Related to #101.

# Create aliases for our light-blue and dark-blue styles to light and dark.
# Only create aliases if light-blue and/or dark-blue are to be built.
themes = [theme for theme in args.styles if theme in ('dark-blue', 'light-blue')]
for theme in themes:
source = args.output_dir / theme / 'stylesheet.qss'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be improved to use a set but it's fine as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. When you say it could be improved using a set , do you mean as below? If so, what's the benefit to this over using a list comprehension with a tuple? I guess sets are slightly more efficient but is that the only difference in this context? Sorry, probably a noob question!

themes = {theme for theme in args.styles if theme in {'dark-blue', 'light-blue'}}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did something like this:

set(args.styles) & {'dark-blue', 'light-blue'}

It uses set intersection to grab the overlap between the two. Technically a bit slower but the performance really doesn't matter: it's very easy to read and can be extended pretty well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good info, thanks. I didn't know set intersection was available in Python so easily. Thanks

@Alexhuszagh Alexhuszagh merged commit 13826e0 into Alexhuszagh:main Sep 8, 2024
16 checks passed
@Alexhuszagh
Copy link
Owner

By the way, I implemented #113 to deal with the increasing bundle sizes caused by #110 and due to an increasing number of variants of each style. This compresses the total size by >=90% and more themes will lead to a higher compression ratio, so there;s no real concerns ever adding more and more themes.

So if you have more good theme ideas, there's no real downside to adding them anymore, and thank you.

@Inverted-E
Copy link
Contributor Author

#113 is a good idea. I may add some new colors when I have some time. I also thought about adding a flag to disable the aliasing if not required in order to reduce file size but I guess that's less of a priority now. May still add it though if you think it's worth it?

@Alexhuszagh
Copy link
Owner

#113 is a good idea. I may add some new colors when I have some time. I also thought about adding a flag to disable the aliasing if not required in order to reduce file size but I guess that's less of a priority now. May still add it though if you think it's worth it?

Much less so, also you can manually provide individual styles so you can choose a subset if required. Those will also compress very nicely so I can't imagine they'd affect file size more than a few bytes.

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

Successfully merging this pull request may close these issues.

2 participants