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

Update code to not get images from placeholder.com #51

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

Carreau
Copy link
Collaborator

@Carreau Carreau commented Apr 4, 2024

It has been bought by a new company and images might not hold
forever. Use local pngs to do that.

Fixes #44

@Carreau
Copy link
Collaborator Author

Carreau commented Apr 4, 2024

I'm tempted to immediately update this script to create local 20x20 images and not rely on external providers.

@Carreau
Copy link
Collaborator Author

Carreau commented Apr 4, 2024

The script to create those images is trivial:

from PIL import Image

width, height = 20, 20


def hex_to_rgb(hex_string):
    hex_string = hex_string.lstrip("#")
    r = int(hex_string[0:2], 16)
    g = int(hex_string[2:4], 16)
    b = int(hex_string[4:6], 16)
    return (r, g, b)


hex_color = "#ccff44"
rgb_color = hex_to_rgb(hex_color)

image = Image.new("RGB", (width, height), rgb_color)

image.save("colored_image.png")

@Carreau Carreau force-pushed the rr branch 7 times, most recently from 0a35b87 to 0d87f5a Compare April 4, 2024 11:28
@Carreau
Copy link
Collaborator Author

Carreau commented Apr 4, 2024

Ok, let's try with local png, it seem to work. I also thought of using just a <div style="width: 20px; height: 20px; background-color: red;"></div>, like This ->

<-, but it is sanitized by github.

@Carreau Carreau marked this pull request as ready for review April 4, 2024 11:30
@Carreau
Copy link
Collaborator Author

Carreau commented Apr 4, 2024

Rendering won't work in the PR, you have to look at the fork:

https://github.com/Carreau/accessible-pygments/tree/rr/a11y_pygments/a11y_high_contrast_dark

Also strangely the contrast is not the same, but the colors have not changes. ~~@gabalafou any idea why ? ~~ (never mind)

@trallard trallard requested a review from gabalafou April 8, 2024 16:53
@trallard trallard added area: documentation 📖 Improvements or additions to documentation type: enhancement 💅🏼 New feature or request status: needs review 👀 labels Apr 8, 2024
Copy link
Contributor

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

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

This is awesome! thanks @Carreau!

I left a few suggestions but none of them need be blocking

scripts/update_theme_docs.py Outdated Show resolved Hide resolved
scripts/update_theme_docs.py Outdated Show resolved Hide resolved
scripts/update_theme_docs.py Outdated Show resolved Hide resolved
It has been bought by a new company and images might not hold
forever. Use local pngs to do that.

Fixes Quansight-Labs#44
@Carreau
Copy link
Collaborator Author

Carreau commented Apr 11, 2024

Should have addressed the comments and rebase/squashed to avoid having large intermediate commits.

Copy link
Contributor

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for updating!

It's kinda neat that we can see how many colors are used across all the themes just by looking at the assets folder.

@gabalafou gabalafou merged commit 046c537 into Quansight-Labs:main Apr 11, 2024
5 of 6 checks passed
@Carreau Carreau deleted the rr branch April 12, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: documentation 📖 Improvements or additions to documentation status: needs review 👀 type: enhancement 💅🏼 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not get sprites from via.placeholder.com
3 participants