Code accompanying the manuscript Word–Color Association from Large-Scale Online Data: Methodology and Applications by Sungpil Wang and Juyong Park.
The framework retrieves word–color associations from publicly accessible Google Image Search results: it scrapes the top-results screenshot for a query word, resizes it to 10,000 pixels, converts each pixel to the CIELch color space, and represents the word as a 10-dimensional additive ratio vector over named base colors (red, orange, yellow, green, blue, purple, pink, black, grey, white).
You can set up the required environment using either requirements.txt
(pip) or environment.yml (conda).
brew install python@3.9
/opt/homebrew/opt/python@3.9/bin/python3.9 -m venv venv
source venv/bin/activate
python -m ensurepip --upgrade
pip install --upgrade pip setuptools wheel
pip install -r requirements.txtconda env create -f environment.yaml
conda activate word-color-associationChrome and chromedriver are required for word2image.py (Google Image
Search screenshot via Selenium).
Extract the color vector for a single word:
python main.py --term "moss" --option ratioVisualize the color information of a target word on a local webpage:
cd website
python app.pyword2image.py— Google Image Search screenshot via Selenium (incognito, regional/language presets, light-mode forced via CDP)calculation.py— pixel-to-CIELch conversion, base-color binning, per-word 10-d vector computationcolor_utils.py— shared color-space utilities (rgb_to_lch,color_vector_from_pixels,resize_to_pixel_count, base-color ranges, chroma threshold)visualization.py— per-word color distribution plotsmain.py— command-line entry point
Text2Color.ipynb— extract color vectors per word in long sentences and render as text + color-bar visualizationsLogoAndScreenshotOfBrands.ipynb— top-100 publicly traded companies' logo vs. web-image color comparisonThresholdOfChroma.ipynb— chroma distribution of 15 achromatic terms and the chroma threshold derivationWhiteGridRatio.ipynb— white-divider trimming ratio derived from a 100-screenshot sample (Kolmogorov–Smirnov normality check)ComparisonPoets.ipynb— Lowell vs. Johnson corpus-level color comparison
Each script produces CSV / PDF / PNG / summary-MD outputs under
csv/revision_results/.
nrc_validation.py— NRC Word–Colour Association Lexicon (Mohammad 2013): per-color one-vs-rest AUC + confusion matrixrathore_scrape.py,rathore_compare.py— graded slider ratings (Rathore et al. 2019, IEEE TVCG): per-concept cosine on the UW-58 / BCP-37 palettescompsyn_compare.py— Representational Similarity Analysis (RSA) vs. comp-syn 8-bin JzAzBz histograms (Guilbeault et al. 2020)setlur_scrape.py,setlur_full_pipeline.py,setlur_analyze.py— Setlur & Stone (2016) full-pipeline reproduction: WordNet color-term lookup with Bing-Image-Search dominant-color extraction (k-means + W3C-nearest)
permutation_null.py— Lowell vs. Johnson Δ permutation null test (B = 10,000 size-matched partitions)weighting_sensitivity.py,alpha_robustness_report.py— α-sweep robustness of the Lowell–Johnson contrast over indirect-word weightspolysemy_scrape.py,polysemy_demo.py— bare-token vs. full-registered-name color recovery for polysemous queriesscroll_depth_scrape.py,page_compare_scrape.py,page_compare_analyze.py— page-1 vs. page-10 stability of the recovered color vectorsample_words.py— frequency-random English-word sampling pooldate_filter_test.py— Google Images date-range parameter (tbs=cdr:1,cd_min=…,cd_max=…) sanity check
fig3_brand_similarity_transposed.py— Fig 3 (logo vs. web-image cosine, sorted leaderboard with full registered names)fig4_radar_only.py— Fig 4 (per-company 10-d radar comparison)regen_fig6.py— Fig 6 (Lowell − Johnson Δ with permutation-null SD error bars)make_serp_grids.py— moss / lilac schematic SERP grids used as components of Fig 1 and Fig 2
brand materials/brand_similarity_all_metrics.csv,cosine_summary_by_sector.csv— the logo-vs-web-image cosine similarities and per-sector means reported in the manuscript for the top-100 publicly traded companies (by market capitalization, TradingView, February 2025), used for Fig 3, Fig 4 and S4 Tablecsv/revision_results/— per-analysis outputsbrand materials/— the brand list and numerical outputs for the top-100 companies. Google screenshots and corporate logo images are not redistributed (seebrand materials/README.txt); they are re-scraped byLogoAndScreenshotOfBrands.ipynbImages/— not redistributed (third-party Google Image content; seeImages/README.txt); recreated locally by the scraping scriptsexternal_compare/— public datasets from prior approaches (Rathore UW-58 / BCP-37; comp-syn JzAzBz embeddings) used by validation scripts
Wang, S., & Park, J. Word–Color Association from Large-Scale Online Data: Methodology and Applications. PLOS ONE (under revision).