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

Additional themes and changes to font and theme configuration API #4

Merged
merged 4 commits into from
Feb 10, 2024

Conversation

jentfoo
Copy link
Member

@jentfoo jentfoo commented Feb 10, 2024

This PR includes two new themes and minor API changes around fonts and themes.

The added vivid-light and vivid-dark themes provide bright series colors. The first colors being red, yellow, help highlight the importance of the first two series items.

The full theme list is now light, dark, vivid-light, vivid-dark, ant and grafana.

API updates to how Themes and Fonts are configured for charts:

  • The theme implementation has been updated to be colors only. Fonts and font sizes need to be communicated outside of the theme. This allows the ColorPalette to be immutable.
  • Both the Font and Theme ColorPalette are set directly instead of setting names. This allows you to avoid the central font and theme store if you want. You need to use GetTheme or GetFont to convert the installed name into an instance for the chat configuration.
  • As part of the above, the FontFamily has been removed (except for echarts where it is taken in from json).
  • Tables have had a similar update, the SetDefaultTableSetting function has been removed. Default color logic has been improved to consider if the theme is dark or not, but any non-default settings will need to be specified in the options when creating the table.

README will be updated later

…olorPalette

These themes are a nice addition to the default, providing another light and dark color choice with red, yellow and other bright colors up front on the series.  These themes are useful for any data where the initial items in the series should have the most emphasis.

In addition the ColorPalette interface was changed to remove Set functions so that these structs will always only be read only.
@jentfoo jentfoo self-assigned this Feb 10, 2024
@jentfoo jentfoo changed the title Theme api Additional themes and changes to font and theme configuration API Feb 10, 2024
This includes the following changes for how Themes and Fonts are configured for charts:
* The theme implementation has been updated to be colors only.  Fonts and font sizes need to be communicated outside of the theme always.  This allows the ColorPalette to be immutable.
* Both the Theme ColorPalette and Font are set directly instead of setting names.  This allows you to avoid the central font and theme store if you want.
* As part of the above, the FontFamily has been removed (except for echarts where it is taken in from json).  You need to set the font directly using GetFont(Family) instead.
* The theme implementation has been updated to be thread safe.
* Testing was expanded and updated to often be parallel.  This is to help further validate no central store (like theme or fonts) have race conditions.
Default table settings will now be adjusted based on if the theme is light or dark.  Any table setting adjustements outside of that need to be configured with the specific chart being rendered.
Because there is theme logic for every chart type, this updates the testing so that theme configuration is validated for all chart types as well.
@jentfoo jentfoo merged commit 28bb889 into main Feb 10, 2024
5 checks passed
@jentfoo jentfoo deleted the theme-api branch February 10, 2024 20:28
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.

1 participant