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

How do I add automatic colors in SVG icons? #226

Closed
NaeemBolchhi opened this issue Apr 7, 2023 · 2 comments
Closed

How do I add automatic colors in SVG icons? #226

NaeemBolchhi opened this issue Apr 7, 2023 · 2 comments
Labels
question Further information is requested

Comments

@NaeemBolchhi
Copy link

I'd like to have the SVG icon automatically change colors in light mode and dark mode, like the default icons in Shell. Setting a color in HEX won't achieve this, and I couldn't figure out how to do that from the documentations either. I think updating the examples a bit might be helpful.

I'd also like to know how I can have part of the SVG use the accent color of Shell (blue) while the rest follow the default color (white/black).

This is what I have right now:
item(find='"Ghost Mode"' image=image.svg('<svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 512 512"><path d="M255 2.4c-35.3 10.8-59.1 31.8-63.3 55.9-2.8 16.6 6.4 34 21.8 41.1 18.9 8.8 23.2 11.3 29.2 17.1 10.4 10.2 10.5 18.3.5 27.7-7.3 6.8-17 12-37.7 20.3-22.7 9-51.4 23-64.5 31.6-38.5 24.9-63.7 57-74.4 94.6-5.1 17.7-6.1 26-6 51.3 0 21.6.2 24.5 2.7 36.1 7.1 33.5 19.7 57.1 42.6 79.9 22.7 22.6 49 37.1 83.5 46 41.8 10.7 100.1 10.4 143.8-.9 62.6-16.2 101.7-55.5 114.2-114.7 7.8-37.5 5.9-75.4-5.5-104.1-8.7-22.3-19.8-37.4-47.9-65.3-32.6-32.4-33.3-34.4-18-54.6 13-17.2 18.3-29.7 18.2-43.3-.1-25.6-20.1-42.7-68.7-58.7-11-3.6-23.5-8.4-27.7-10.6-10.3-5.3-18-12.8-22-21.5-2.8-6-3.3-7.9-3.4-15.8-.1-10.3-.5-11.8-4-13.4C265-.4 263.7-.3 255 2.4zm1.4 23.5c.9 6.5 7.3 19.3 13.1 25.8 5.4 6.2 18.3 15 27.5 18.8 3.6 1.5 14.1 5.2 23.4 8.2 26.1 8.4 40.1 15.5 49.1 24.9 5.9 6.3 7.8 11.4 7.3 20.2-.5 8.7-4.3 16.8-14.5 30.3-12.1 16.1-15.2 25.7-12 37 2.9 9.7 8.8 17.3 29.6 37.9 28 27.6 38.1 41.1 46 61.3 7 18.2 8.6 27.9 8.6 53.2 0 18.1-.4 24.1-2.2 34-4.1 22.6-13 44.5-24.3 59.6-6.5 8.7-20.9 22.4-29.5 28-32.1 21.1-78.4 31.4-131.5 29.5-55.8-2-99.2-18.1-129.2-47.9-28.7-28.5-42.2-66.1-40.5-112.2 1.6-40.2 14.6-71.3 41.2-98.1 22.1-22.3 49.2-38.6 94-56.3 9.9-3.9 21.8-9.2 26.4-11.8 11.6-6.6 21.2-15.7 25.3-24.1 6.9-13.9 3.4-27.8-10-40.3-7.8-7.3-14.5-11.6-26.4-16.6-10.8-4.6-13.2-6.4-16.5-12.1-6.2-10.4-2.4-23 10.6-35.5 3.6-3.5 9.5-8.1 13.1-10.2 7-4.1 19.1-9.4 20.1-8.9.4.2.9 2.6 1.3 5.3z" style=""/><path d="M212 198.6c-6.3 2.6-12.3 5.3-13.2 6.1-2.5 2.3-3.2 6.7-1.4 10.1 2.9 5.6 6.6 5.5 21.1-.3 11.6-4.7 15.5-7.7 15.5-12.1 0-3.2-5.1-8.4-8.2-8.4-1.3 0-7.5 2.1-13.8 4.6zm-56.8 29.3c-35.1 23.5-54.6 53.3-59.7 91.1-.8 5.8-1.5 13.8-1.5 17.8 0 6.8.2 7.6 2.9 10.3 1.8 1.7 4 2.9 5.6 2.9 1.6 0 3.8-1.2 5.6-2.9 2.6-2.7 2.9-3.6 2.9-9.6 0-16.8 5.4-39.2 12.7-52.5 9.3-17.1 24.3-32.3 44.5-45.4 4.8-3 9.2-6.4 9.8-7.5 1.6-3.1 1.2-6.6-1.1-9.5-1.6-2-2.9-2.6-5.9-2.6-3.2 0-6 1.4-15.8 7.9zm9.3 80C148 312.2 137 329.1 137 350c0 18.4 8.8 34 22.6 40.2 10.4 4.6 24 1.4 32.7-7.6 23.6-24.7 11-72.9-19.6-75.1-2.9-.2-6.5-.1-8.2.4zm13.6 19.2c4.2 3 7.6 9.4 9 17.1 1 5.7 1 7.6-.4 13.2-2.8 11.4-8.6 17.6-16.4 17.6-3.5 0-5-.7-8.3-3.6-5.9-5.3-8.3-12.6-7.8-23.5.5-10.9 4.1-18.1 10.9-21.7 5-2.6 8.4-2.4 13 .9zm154.2-18.3c-17.8 6.3-28.5 29.4-23.9 51.2 4.2 19.6 17 32.1 33 32.1 28.9 0 44.3-41.9 25.7-69.7-8.4-12.6-22.4-18-34.8-13.6zm14.1 17.2c7.3 3.6 11.5 12.1 11.6 23.7 0 14-7.1 25.3-16.1 25.3-8.1 0-13.7-5.9-16.5-17.3-1.5-5.9-1.5-7.7-.5-13.8 1.5-8.2 5.8-15.3 11.1-18.1 4.4-2.3 5.4-2.3 10.4.2zm-99.9 59.3c-9.8 3.3-17.2 9.7-21.3 18.5-2.3 4.9-2.7 7.1-2.7 14.7 0 8.4.2 9.5 3.4 15.3 3.8 7 8.9 11.9 16 15.4 6.7 3.3 21.5 3.3 28.2 0 7.1-3.5 12.2-8.4 16-15.4 3.2-5.8 3.4-6.9 3.4-15.3 0-7.6-.4-9.9-2.6-14.6-5.5-11.7-16.4-18.9-29.3-19.6-4.1-.1-8.8.3-11.1 1zm15.8 17.1c4.4 1.8 9.5 7.8 10.3 12.1 2.7 14.4-11.7 25.1-24.7 18.5-9.4-4.8-11.7-17.6-4.6-25.7 5.3-6 12.2-7.8 19-4.9z"/></svg>'))

@moudey
Copy link
Owner

moudey commented Apr 7, 2023

item(find='"Ghost Mode"' image=image.svg('<svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 512 512">

<path fill="@(theme.isdark ? '#fff':'#000')" 

d="M255 2.4c-35.3 10.8-59.1 31.8-63.3 55.9-2.8 16.6 6.4 34 21.8 41.1 18.9 8.8 23.2 11.3 29.2 17.1 10.4 10.2 10.5 18.3.5 27.7-7.3 6.8-17 12-37.7 20.3-22.7 9-51.4 23-64.5 31.6-38.5 24.9-63.7 57-74.4 94.6-5.1 17.7-6.1 26-6 51.3 0 21.6.2 24.5 2.7 36.1 7.1 33.5 19.7 57.1 42.6 79.9 22.7 22.6 49 37.1 83.5 46 41.8 10.7 100.1 10.4 143.8-.9 62.6-16.2 101.7-55.5 114.2-114.7 7.8-37.5 5.9-75.4-5.5-104.1-8.7-22.3-19.8-37.4-47.9-65.3-32.6-32.4-33.3-34.4-18-54.6 13-17.2 18.3-29.7 18.2-43.3-.1-25.6-20.1-42.7-68.7-58.7-11-3.6-23.5-8.4-27.7-10.6-10.3-5.3-18-12.8-22-21.5-2.8-6-3.3-7.9-3.4-15.8-.1-10.3-.5-11.8-4-13.4C265-.4 263.7-.3 255 2.4zm1.4 23.5c.9 6.5 7.3 19.3 13.1 25.8 5.4 6.2 18.3 15 27.5 18.8 3.6 1.5 14.1 5.2 23.4 8.2 26.1 8.4 40.1 15.5 49.1 24.9 5.9 6.3 7.8 11.4 7.3 20.2-.5 8.7-4.3 16.8-14.5 30.3-12.1 16.1-15.2 25.7-12 37 2.9 9.7 8.8 17.3 29.6 37.9 28 27.6 38.1 41.1 46 61.3 7 18.2 8.6 27.9 8.6 53.2 0 18.1-.4 24.1-2.2 34-4.1 22.6-13 44.5-24.3 59.6-6.5 8.7-20.9 22.4-29.5 28-32.1 21.1-78.4 31.4-131.5 29.5-55.8-2-99.2-18.1-129.2-47.9-28.7-28.5-42.2-66.1-40.5-112.2 1.6-40.2 14.6-71.3 41.2-98.1 22.1-22.3 49.2-38.6 94-56.3 9.9-3.9 21.8-9.2 26.4-11.8 11.6-6.6 21.2-15.7 25.3-24.1 6.9-13.9 3.4-27.8-10-40.3-7.8-7.3-14.5-11.6-26.4-16.6-10.8-4.6-13.2-6.4-16.5-12.1-6.2-10.4-2.4-23 10.6-35.5 3.6-3.5 9.5-8.1 13.1-10.2 7-4.1 19.1-9.4 20.1-8.9.4.2.9 2.6 1.3 5.3z" style=""/>


<path fill="@image.color2"  /* or use color.accent */

d="M212 198.6c-6.3 2.6-12.3 5.3-13.2 6.1-2.5 2.3-3.2 6.7-1.4 10.1 2.9 5.6 6.6 5.5 21.1-.3 11.6-4.7 15.5-7.7 15.5-12.1 0-3.2-5.1-8.4-8.2-8.4-1.3 0-7.5 2.1-13.8 4.6zm-56.8 29.3c-35.1 23.5-54.6 53.3-59.7 91.1-.8 5.8-1.5 13.8-1.5 17.8 0 6.8.2 7.6 2.9 10.3 1.8 1.7 4 2.9 5.6 2.9 1.6 0 3.8-1.2 5.6-2.9 2.6-2.7 2.9-3.6 2.9-9.6 0-16.8 5.4-39.2 12.7-52.5 9.3-17.1 24.3-32.3 44.5-45.4 4.8-3 9.2-6.4 9.8-7.5 1.6-3.1 1.2-6.6-1.1-9.5-1.6-2-2.9-2.6-5.9-2.6-3.2 0-6 1.4-15.8 7.9zm9.3 80C148 312.2 137 329.1 137 350c0 18.4 8.8 34 22.6 40.2 10.4 4.6 24 1.4 32.7-7.6 23.6-24.7 11-72.9-19.6-75.1-2.9-.2-6.5-.1-8.2.4zm13.6 19.2c4.2 3 7.6 9.4 9 17.1 1 5.7 1 7.6-.4 13.2-2.8 11.4-8.6 17.6-16.4 17.6-3.5 0-5-.7-8.3-3.6-5.9-5.3-8.3-12.6-7.8-23.5.5-10.9 4.1-18.1 10.9-21.7 5-2.6 8.4-2.4 13 .9zm154.2-18.3c-17.8 6.3-28.5 29.4-23.9 51.2 4.2 19.6 17 32.1 33 32.1 28.9 0 44.3-41.9 25.7-69.7-8.4-12.6-22.4-18-34.8-13.6zm14.1 17.2c7.3 3.6 11.5 12.1 11.6 23.7 0 14-7.1 25.3-16.1 25.3-8.1 0-13.7-5.9-16.5-17.3-1.5-5.9-1.5-7.7-.5-13.8 1.5-8.2 5.8-15.3 11.1-18.1 4.4-2.3 5.4-2.3 10.4.2zm-99.9 59.3c-9.8 3.3-17.2 9.7-21.3 18.5-2.3 4.9-2.7 7.1-2.7 14.7 0 8.4.2 9.5 3.4 15.3 3.8 7 8.9 11.9 16 15.4 6.7 3.3 21.5 3.3 28.2 0 7.1-3.5 12.2-8.4 16-15.4 3.2-5.8 3.4-6.9 3.4-15.3 0-7.6-.4-9.9-2.6-14.6-5.5-11.7-16.4-18.9-29.3-19.6-4.1-.1-8.8.3-11.1 1zm15.8 17.1c4.4 1.8 9.5 7.8 10.3 12.1 2.7 14.4-11.7 25.1-24.7 18.5-9.4-4.8-11.7-17.6-4.6-25.7 5.3-6 12.2-7.8 19-4.9z"/></svg>'))

@moudey moudey added the question Further information is requested label Apr 7, 2023
@NaeemBolchhi
Copy link
Author

That worked perfectly. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants