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

Update core icons to support new theming system #4993

Merged
merged 12 commits into from
Feb 15, 2024

Conversation

bartaz
Copy link
Member

@bartaz bartaz commented Feb 14, 2024

Done

Updates the icons to use new CSS variables for theming.
Involved a bit of refactoring, so that both previous way of including icon mixins works and the new themed icons.

So currently icons have 2 mixins each:

@vf-icon-NAME($color) - that is deprecated and backwards compatible way of including an icon with an option to change its colour.

@vf-icon-NAME-themed - that is a new recommended way to include icon, that will use the icon colour defined by current theme (via CSS variables).

This PR also updates icon colours, to use default text colour in each theme, so black in light themes, and white in dark theme.

We also introduce --vf-is-light-theme and --vf-is-dark-theme CSS variables that are used by icon mixins to conditionally switch to correct version. This is based on a "var space hack" solution explained in this blog post: https://lea.verou.me/blog/2020/10/the-var-space-hack-to-toggle-multiple-values-with-one-custom-property/

NOTE New theming is only applied to standard set of Vanilla icons that are directly included in Vanilla. It doesn't cover all individual icons in the "additional" set.

Fixes WD-8624

QA

  • Open demo
  • Check if icons display correctly in dark variant
  • Change the body class name to is-light or is-paper, check if icons adjust accordingly
  • Review icons in context of other components to make sure they render correctly:
  • Review updated documentation:

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.

Screenshots

image image image

@bartaz bartaz added the Feature 🎁 New feature or request label Feb 14, 2024
@webteam-app
Copy link

Demo starting at https://vanilla-framework-4993.demos.haus

@bartaz bartaz marked this pull request as ready for review February 14, 2024 15:01
@bartaz bartaz changed the title WIP: Update core icons to support new theming system Update core icons to support new theming system Feb 14, 2024
Copy link
Contributor

@chillkang chillkang left a comment

Choose a reason for hiding this comment

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

LGTM👍 This is incredible Bartek!

@britneywwc
Copy link
Contributor

Cool stuff! The flagging with whitespace usage is very interesting

@bartaz bartaz merged commit 0f3d682 into canonical:main Feb 15, 2024
5 checks passed
@bartaz bartaz deleted the icons-theme branch February 15, 2024 10:31
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.

5 participants