This is the kind of quirky, brilliant link I crave from Hacker News. If I was near you creator, I would garland you and rub your feet.
Quoted post unavailable.
Hexwords: Hex colors that are similar to words
81–90 of 182 posts
Re: Hexwords: Hex colors that are similar to words
#82Re: Hexwords: Hex colors that are similar to words
#83Doesnt work with Firefox http://0x0.st/oMvf.png
Re: Hexwords: Hex colors that are similar to words
#84This is the kind of quirky, brilliant link I crave from Hacker News. If I was near you creator, I would garland you and rub your feet.
Re: Hexwords: Hex colors that are similar to words
#85This is the kind of quirky, brilliant link I crave from Hacker News. If I was near you creator, I would garland you and rub your feet.
Re: Hexwords: Hex colors that are similar to words
#86So which of these actually spell the color they represent (or something closely related)? From a quick glance, I have no found any. Do color-words like that exist in other languages maybe?
#1C1E57 (ICIEST) is dark blue, which could hold true in certain contexts! #DEBA65 (DEBAGS) is brown, much like de color of de bags made of de paper. And on a related and exceptionally juvenile note, it should be very possible - and frankly obligatory, for those in fashion tech companies reading this - to create and sell a #B00B1E colored bra.
Still gives me a chuckle. Grow up.
Re: Hexwords: Hex colors that are similar to words
#87Earlier quoted context omitted.
#1C1E57 (ICIEST) is dark blue, which could hold true in certain contexts! #DEBA65 (DEBAGS) is brown, much like de color of de bags made of de paper. And on a related and exceptionally juvenile note, it should be very possible - and frankly obligatory, for those in fashion tech companies reading this - to create and sell a #B00B1E colored bra.
Tangentially related, and equally juvenile, I own the telephone number in Australia: 08 80087355 Still gives me a chuckle. Grow up.
Re: Hexwords: Hex colors that are similar to words
#88So which of these actually spell the color they represent (or something closely related)? From a quick glance, I have no found any. Do color-words like that exist in other languages maybe?
Basically: get the color of the _word_ by doing an image search and extracting the dominant color from the first image result. Then compare that color to the hex color (in CIELAB color space) to get the color difference. Track the hex words with lowest difference.
Here's a rough impl in Python:
import sys
import os
import heapq
import requests
from google.cloud import vision
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
from bs4 import BeautifulSoup
def download_image_for_query(query):
search_key = os.getenv("GOOGLE_CUSTOM_SEARCH_ENGINE_KEY")
search_engine_id = os.getenv("GOOGLE_CUSTOM_SEARCH_ENGINE_ID")
resp = requests.get(
f"https://www.googleapis.com/customsearch/v1?key={search_key}&cx={search_engine_id}&q={query}&searchType=image"
)
img_url = resp.json()["items"][0]["link"]
img_content = requests.get(img_url).content
return img_content
def dominant_rgb_colors(image_content, num_colors=1):
vision_client = vision.ImageAnnotatorClient()
image = vision.Image(content=image_content)
response = vision_client.annotate_image({"image": image})
return [
(int(c.color.red), int(c.color.green), int(c.color.blue))
for c in response.image_properties_annotation.dominant_colors.colors
][:num_colors]
# class to store hex word and calculate the difference from "true" image, based on image search
class HeapibleHexWord:
def generate_rgb_version(self):
return tuple(int(self.hex_version.lstrip("#")[i:i+2], 16) for i in (0, 2, 4))
def __init__(self, hex_version, english_version):
self.hex_version = hex_version
self.english_version = english_version
self.rgb_version = self.generate_rgb_version()
self.delta_from_true = float("inf")
def calculate_delta_from_true(self):
true_rgb = sRGBColor(*self.rgb_version)
query = self.english_version
img_content = download_image_for_query(query)
test_rgb = sRGBColor(*dominant_rgb_colors(img_content)[0])
# via http://hanzratech.in/2015/01/16/color-difference-between-2-colors-using-python.html
delta = delta_e_cie2000(
convert_color(true_rgb, LabColor),
convert_color(test_rgb, LabColor)
)
self.delta_from_true = delta
def __lt__(self, other):
return self.delta_from_true Re: Hexwords: Hex colors that are similar to words
#89And also three-digit color codes, such as #BAD. And for non-hex colors, we have this: https://stackoverflow.com/questions/8318911/why-does-html-th...