Skip to content

Theme | New theme: Patterns #275

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

Merged
merged 3 commits into from
Oct 11, 2023
Merged

Theme | New theme: Patterns #275

merged 3 commits into from
Oct 11, 2023

Conversation

reb-dev
Copy link
Contributor

@reb-dev reb-dev commented Sep 13, 2023

The PR adds a new theme to the library.

Pattern Theme

When document.body has the class theme-patterns we automatically apply patterns of two types:

  • Fill patterns for solid shapes (most cases). Users can customize fill patterns by assigning --vis-pattern${i} to a valid SVG def of a mask element. The default palette looks like:
Screen Shot 2023-10-03 at 2 56 27 PM

with the corresponding css variables:

--vis-pattern-fill0: var(--vis-pattern-fill-stripes-diagonal);
--vis-pattern-fill1: var(--vis-pattern-fill-dots);
--vis-pattern-fill2: var(--vis-pattern-fill-stripes-vertical);
--vis-pattern-fill3: var(--vis-pattern-fill-crosshatch);
--vis-pattern-fill4: var(--vis-pattern-fill-waves);
--vis-pattern-fill5: var(--vis-pattern-fill-circles);
  • Line patterns for the Line component and when BulletLegend's bulletShape property is set to "line". Users can customize these patterns by assigning --vis-pattern-marker${i} to a valid SVG def of a marker element or --vis-pattern-dasharray${i} to a valid value for the stroke-dasharray property. The default palette looks like:
Screen Shot 2023-10-03 at 2 56 48 PM

with the corresponding css variables:

--vis-pattern-marker0: var(--vis-pattern-marker-circle);

--vis-pattern-marker1: var(--vis-pattern-marker-triangle);
--vis-pattern-dasharray1: 9 1;

--vis-pattern-marker2: var(--vis-pattern-marker-diamond);
--vis-pattern-dasharray2: 2;

--vis-pattern-marker3: var(--vis-pattern-marker-arrow);
--vis-pattern-dasharray3: 2 3 8 3;

--vis-pattern-marker4: var(--vis-pattern-marker-square);
--vis-pattern-dasharray4: 6;

--vis-pattern-marker5: var(--vis-pattern-marker-star);
--vis-pattern-dasharray5: 1 6;

Other changes:

  • Added a theme selector to the dev demo app (toggle switch for dark/light theme, wand button toggles pattern theme)
  • Tweaked Bullet Legend's viewBox sizing method to accommodate the patterns (tweaking the viewBox height instead of the width gives the best results for both types)

@reb-dev reb-dev force-pushed the feature/accessibility-theme branch from 553f7d1 to 48662c5 Compare September 13, 2023 22:24
Copy link
Contributor

@rokotyan rokotyan left a comment

Choose a reason for hiding this comment

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

Overall looks great, the implementation is clean and clear. I've only left a few comments.

@reb-dev reb-dev force-pushed the feature/accessibility-theme branch from 48662c5 to 617352a Compare October 3, 2023 21:57
@reb-dev reb-dev force-pushed the feature/accessibility-theme branch from 617352a to 592f7f9 Compare October 10, 2023 23:54
@reb-dev reb-dev requested a review from rokotyan October 11, 2023 00:43
@rokotyan rokotyan merged commit b3166f5 into main Oct 11, 2023
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.

2 participants