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

Add the system_fonts() helper function #158

Merged
merged 9 commits into from
Feb 2, 2024
Merged

Conversation

rich-iannone
Copy link
Member

This introduces the system_fonts() helper function, and this allows for obtaining a list of themed fonts, the collection of which is expected to work well across computing platforms. There are 15 font stacks in total, and the function is useful within tab_options() (for the table_font_names parameter).

Fixes: #157

@github-actions github-actions bot temporarily deployed to pr-158 February 2, 2024 05:20 Destroyed
Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

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

I left a comment on improving font stacks code

if name not in font_stack_names:
raise ValueError(f"Invalid font stack name: {name}")

if name == "system-ui":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this a dictionary? Something like...

FONT_STACKS = {
    "system-ui": ["system-ui", "sans-serif"],
    "transitional": ...
}

Then system fonts could return something like FONT_STACKS[name] (with handling for emojis, and erroring on bad font stack name.

It might be worth putting FONT_STACKS its own file (similar to _data_color/constants.py), or maybe isn't too bad at the top of _helpers.py

@rich-iannone
Copy link
Member Author

Will merge this even in it's early state (agreement from pairing). But will revisit again.

@rich-iannone rich-iannone merged commit feed2f5 into main Feb 2, 2024
7 checks passed
@rich-iannone rich-iannone deleted the system-fonts-font-stacks branch February 2, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function to obtain 'font stacks': themed fonts that work well across systems
2 participants