Skip to content

fix(action): icon preview light and dark mode #3389

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielbayley
Copy link
Member

Fixes #1489 properly, improving on #1493.

Description

Fix icon preview to display correctly, cross-browser, including a temporary bug fix for WebKit.

Before Submitting

@github-actions github-actions bot added the 🌍 site Has to do something with the Lucide website label Jul 5, 2025
@github-actions github-actions bot added the 🎨 icon About new icons label Jul 5, 2025
Copy link

github-actions bot commented Jul 5, 2025

Added or changed icons

icons/houses.svg

Preview cohesion icons/message-square-quote.svg
icons/houses.svg
icons/toggle-right.svg
Preview stroke widths icons/houses.svg
icons/houses.svg
icons/houses.svg
DPI Preview

16px (shadcn/ui)

icons/houses.svg

24px (default)

icons/houses.svg

32px (shadcn/ui + retina)

icons/houses.svg

48px (default + retina)

icons/houses.svg
Icon X-rays icons/houses.svg
Icon Diffs icons/houses.svg
Icons as code

Works for: lucide-react, lucide-react-native, lucide-preact, lucide-vue-next

const HousesIcon = createLucideIcon('Houses', [
  ["path",{"d":"M10 20v-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5"}],
  ["path",{"d":"M6 17H3a1 1 0 0 1-1-1V9.5c0-.6.3-1.2.7-1.6l4.6-3.7a1 1 0 0 1 1.3 0l8.7 7.3c.4.4.7.9.7 1.5v6a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6c0-.6.3-1.1.7-1.5l8.6-7.3a1 1 0 0 1 1.3 0l4.6 3.7c.5.4.8 1 .8 1.6V16a1 1 0 0 1-1 1h-3"}]
])

@danielbayley danielbayley force-pushed the icon-preview-action-fix-webkit branch 3 times, most recently from c9c44aa to 7f72657 Compare July 5, 2025 23:53
@jguddas
Copy link
Member

jguddas commented Jul 6, 2025

modified to point to the preview url

Added or changed icons

icons/houses.svg

Preview cohesion icons/message-square-reply.svg
icons/houses.svg
icons/eye.svg
Preview stroke widths icons/houses.svg
icons/houses.svg
icons/houses.svg
DPI Preview

16px (shadcn/ui)

icons/houses.svg

24px (default)

icons/houses.svg

32px (shadcn/ui + retina)

icons/houses.svg

48px (default + retina)

icons/houses.svg
Icon X-rays icons/houses.svg
Icon Diffs icons/houses.svg
Icons as code

Works for: lucide-react, lucide-react-native, lucide-preact, lucide-vue-next

const HousesIcon = createLucideIcon('Houses', [
  ["path",{"d":"M10 20v-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5"}],
  ["path",{"d":"M6 17H3a1 1 0 0 1-1-1V9.5c0-.6.3-1.2.7-1.6l4.6-3.7a1 1 0 0 1 1.3 0l8.7 7.3c.4.4.7.9.7 1.5v6a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6c0-.6.3-1.1.7-1.5l8.6-7.3a1 1 0 0 1 1.3 0l4.6 3.7c.5.4.8 1 .8 1.6V16a1 1 0 0 1-1 1h-3"}]
])

Copy link
Member

@jguddas jguddas left a comment

Choose a reason for hiding this comment

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

Doesn't work, tested in firefox and chrome.

Test cases:

  • dark / light mode in system settings
  • dark / light mode in github settings

To get the raw code from the preview comment you can click on reference in new issue.
image

@danielbayley
Copy link
Member Author

danielbayley commented Jul 6, 2025

Doesn't work, tested in firefox and chrome.

Yeah I should have marked this as draft; it got mangled playing around with PRs to my fork (just trying to get the action running properly on there) to test properly… but running into 403 errors, do I need to set a particular repo *_TOKEN for the action? I haven’t had time to fully dig through the various composite actions involved…

So the correct CSS workaround for the underlying bug—which a multibillion dollar company seems unable to fix—is as follows:

:root { color-scheme: light dark }
* { stroke: currentcolor }
_::-webkit-full-page-media, _:future, :root * {
  stroke: white;
  mix-blend-mode: difference;
}

This works for the SVGs in READMEs on many of my other repos, and others.

The only issue here, with this applied to overlapping strokes (and only on WebKit) is the mix-blend-mode re-inverting the overlapping stroke parts… Not sure exactly how to address that. Possibly along the lines of fill-rule="nonzero" or something? Here’s a directly uploaded example:

preview

To get the raw code from the preview comment you can click on reference in new issue.

Thanks @jguddas, that beats trying to copy it and cleanup from the Actions run log… But ideally, I was hoping to get the bot running exactly the same on my fork…

@danielbayley danielbayley force-pushed the icon-preview-action-fix-webkit branch from 7f72657 to 1d54397 Compare July 6, 2025 14:55
@danielbayley danielbayley requested a review from jguddas July 6, 2025 15:05
@danielbayley danielbayley force-pushed the icon-preview-action-fix-webkit branch from c0ea026 to 1d54397 Compare July 6, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 icon About new icons 🌍 site Has to do something with the Lucide website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve icon preview action
2 participants