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

[IMP] gen_addon_icon: generate cool icons with popular icon libs #491

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

Conversation

chienandalu
Copy link
Member

Generate the app icon easily from a variety of choices. Based on this codepen by Fabrice Hernion: https://twitter.com/fheodoo/status/1363598364638539776

Example of usage:

oca-gen-addon-icon --addon-dir=stock_forecast_report --icon-set-params "fas fa-air-freshener" --icon-color green --icon-padding 15

generate-icon

@pedrobaeza
Copy link
Member

Great stuff! Do we have SVG support? 🙏

@GSLabIt
Copy link

GSLabIt commented Mar 12, 2021

Great stuff, would https://codepen.io/fheodoo/pen/XWNawZd help to make icons look and feel more like v 12 onward?

@Rad0van
Copy link

Rad0van commented Mar 12, 2021

Fantastic!

@chienandalu
Copy link
Member Author

Great stuff! Do we have SVG support?

Yeah, it's just a matter of adding an extra flag 😄

@chienandalu
Copy link
Member Author

Great stuff, would https://codepen.io/fheodoo/pen/XWNawZd help to make icons look and feel more like v 12 onward?

Well, that's been the base for this. With the first test, I was having issus with wkhtmltoimage rendering of css shadows and rounded borders, so for the moment I chose a simpler design

@GSLabIt
Copy link

GSLabIt commented Mar 17, 2021

https://spilymp.github.io/ibo/
could help?

@pedrobaeza
Copy link
Member

Please rebase and fix conflicts.

@alexis-via
Copy link

Works well, I manage to generate this icon using the script: https://github.com/akretion/vertical-abbey/blob/14-mig-stay/stay/static/description/icon.png
I used this command line:

oca-gen-addon-icon --icon-set-params "fas fa-solid fa-bed" --icon-color pink --addon-dir=/home/alexis/dev/abbey4/stay

There is one small problem: the logo is not centered: it touches the right border. The option --icon-padding 15 that is mentioned in the example in the first message of this PR doesn't exist any more and I haven't found any replacement. Any idea how I could center the icon ? I don't have this problem with Fabrice's codepen.

@alexis-via
Copy link

I confirm the problem, cf this other icon I just generated: https://github.com/akretion/vertical-abbey/blob/14-mig-mass/mass/static/description/icon.png
The icon is not centered in the PNG, it touches the right border.

@chienandalu
Copy link
Member Author

chienandalu commented Dec 21, 2021

Yes, the last thing I added was a way to allow some complexity so you could overlap icons, set colors, etc. with the param icon-extra, which expects a dictionary with the icon classes as keys containing a dictionary with some allowed css properties and values (see the _prepare_extra_icon_html method). An example with your icon:

oca-gen-addon-icon --addon-dir=. --format png --icon-extra='{"fa fa-church": {"position": "absolute", "top": "12px", "left": "8px"}}' --icon-color pink

@alexis-via
Copy link

@chienandalu Thanks for the tip! The icons are now centered!

@bosd
Copy link

bosd commented May 14, 2022

Is it possible to include: https://github.com/boydjd/FontCountry
for localizations?
example:
image

@alexis-via
Copy link

For my last icon generation, I used "font-size": "70px" to manage the size of the image inside the icon. The full command line I used was:

oca-gen-addon-icon --addon-dir=. --format png --icon-extra='{"fa fa-bed": {"position": "absolute", "top": "30px", "left": "20px", "font-size": "70px"}}' --icon-color pink

Copy link

@bosd bosd left a comment

Choose a reason for hiding this comment

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

Cool Feature!

@bosd
Copy link

bosd commented Oct 2, 2023

@chienandalu Can you fix the merge conflicts?

@chienandalu
Copy link
Member Author

It's abandoned on my side. Any supersed will be welcome ;)

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.

6 participants