Skip to content

Instantly share code, notes, and snippets.

@nanzhong
Created November 29, 2020 17:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanzhong/4fd76d9a27c768f0228620f1c41443d6 to your computer and use it in GitHub Desktop.
Save nanzhong/4fd76d9a27c768f0228620f1c41443d6 to your computer and use it in GitHub Desktop.
Copic Colours
require 'json'
require 'open-uri'
colours = {}
URI.open("https://copic.jp/en/about/color_system/") do |f|
matches = f.read.scan(/<td class="c_([a-fA-F0-9]{6})">(?:<span>)?([\w-]+)/)
matches.each do |hex, name|
colours[name] = "##{hex}"
end
end
puts JSON.pretty_generate(colours)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment