jaynewey / django-octicons-v10

Django templatetags for GitHub Octicons v10.0.0+.
https://pypi.org/project/django-octicons-v10/
MIT License
2 stars 4 forks source link

Logo changes if size changes #2

Closed Aypac closed 4 years ago

Aypac commented 4 years ago

I would like to embed the 16px upload icon, which works when I do

{% octicon "upload" height="16" %}

I would like to embed it at a larger scaling, e.g.

{% octicon "upload" height="40" %}

However, If I do this, I get the alternate logo with the bar on top rather than below.

Is this desired behaviour? Can I suppress it and get the smaller logo at a bigger scaling?

jaynewey commented 4 years ago

I would like to embed the 16px upload icon, which works when I do

{% octicon "upload" height="16" %}

I would like to embed it at a larger scaling, e.g.

{% octicon "upload" height="40" %}

However, If I do this, I get the alternate logo with the bar on top rather than below.

Is this desired behaviour? Can I suppress it and get the smaller logo at a bigger scaling?

Hmm, this is desired behaviour, as the icon with the bar on top is the 24px variant. Whenever specifying a height, the module picks the best variant. What I mean by this is any icons with a height of more than 16px will default to the 24px variant.

I was not aware that there were icons with these types of differences between variants. I'm considering adding a new parameter variant or something similar that can be used to override this behaviour then.

Do you know if GitHub's helper libraries do anything like this?

Thanks for the heads up.

Aypac commented 4 years ago

Hey, thanks for your reply :) As all of them are vector graphics, I'm a bit unclear on what constitutes a better version for one or the other size. I guess level of detail could be a thing, but in this case it seems kind of random to me. For me at least, I usually pick a specific icon I want to use, so I'd rather have more control than the convenience of the library automatically picking. That might also really give undesired behavior e.g. in the difference between mobile and desktop versions of the site.

Do you know if GitHub's helper libraries do anything like this?

I'm not sure what you are referring to :/

jaynewey commented 4 years ago

As all of them are vector graphics, I'm a bit unclear on what constitutes a better version for one or the other size. I guess level of detail could be a thing, but in this case it seems kind of random to me.

This is correct, but it's not random, however I see your point.

For me at least, I usually pick a specific icon I want to use, so I'd rather have more control than the convenience of the library automatically picking. That might also really give undesired behavior e.g. in the difference between mobile and desktop versions of the site.

Agreed, actually.

I was referring to the official Ruby and Javscript libraries as this library is meant to be similar.

Solution

I'll push out a new release soonish, allowing you to manually choose which variant you want to use, in your case:

{% octicon "upload-16" height=40 %}

Since you want the 16px variant.

jaynewey commented 4 years ago

@Aypac I've added this functionality, to use it, please upgrade to v1.1.0. Overall I think it's a really positive change. Thanks for your feedback. :+1:

Please consider starring the project if you find it useful! It would also be nice to see what you make with it :smiley:

Aypac commented 4 years ago

Thanks a bunch+ ⭐! Have not had the time to test it yet, but will try it soon! If I publish it, I will let you know :)