Closed Carreau closed 7 months ago
I'm tempted to immediately update this script to create local 20x20 images and not rely on external providers.
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")
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 ->
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)
Should have addressed the comments and rebase/squashed to avoid having large intermediate commits.
It has been bought by a new company and images might not hold forever. Use local pngs to do that.
Fixes #44