-
Notifications
You must be signed in to change notification settings - Fork 9
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
Parameterised aspects of the identicon #2
Open
McPo
wants to merge
17
commits into
flavono123:master
Choose a base branch
from
McPo:added-more-parameters
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…icon into added-more-parameters
…turn importing PIL. However as setup.py had not yet installed PIL, it crashed out with Unkown Module during the installation of the Identicon library. The only reason why Identicon was being imported into setup.py, was for the version number. So I just moved the version from Identicon to setup.py
Is there anything preventing this from being merged? |
flavono123
approved these changes
Apr 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very sorry for my late
Identicon/__init__.py
Outdated
@@ -48,7 +48,7 @@ def _extract_color(hex_list): | |||
r,g,b =tuple(hex_list[i:i+2] | |||
for i in range(0, 2*3, 2)) | |||
|
|||
return f'#{r}{g}{b}' | |||
return '#{r}{g}{b}'.format(r=r,g=g,b=b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to show the reference link on it, use format()
rather than f
sigil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implemented parameters for input_hash_str, image size, padding, background colour, foreground colour, corner radius , lightness, saturation and image type.
input_hash_str allows directly inserting a hash, which allows for other possibilities other than MD5
Background colour and foreground colour can now be set to static colours, or if they are set to None the dynamic colour will be used. This means the foreground can be white and the background can have a dynamic colour instead.
The dynamic colour is now generated using HLS, in the same manner as http://identicon.net. This gives a more consistent look to the generated Identicons. Not sure if your happy accepting the new colour generating algorithm, although it does appear to produce better results.
All the defaults remain the same except for the border_radius it defaults to None. It seemed the most appropriate thing to do.
The motivator for these changes, was that I needed to create a GitHub-esque Identicon, which would be circle cropped (When displayed in a list view, but square when viewed in full). Hence I needed to be able to adjust the padding, such that it looked good when circle cropped. Along with removing the post-process corner radius, and flipping the dynamic colours. Obviously changing the size of the image was also relevant.
This is the code I used to achieve the above.