Mobile app version of vmapp.org
Login or Join
Gonzalez368

: Table of hex colors for NCAA teams? Greetings designers. I've done enough googling to know that there are other people looking for this color table, but I can't find it for the life of me.

@Gonzalez368

Posted in: #Color #ColorReproduction

Greetings designers.

I've done enough googling to know that there are other people looking for this color table, but I can't find it for the life of me. I'm close to trying to write a script to scrape this off wikipedia but thought I'd ask here first.

Has anyone found a table of NCAA Division 1 school colors?

Ideal format has columns for primary and secondary colors with hex codes. I apologize if this isn't an appropriate forum for this question, please let me know.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez368

3 Comments

Sorted by latest first Latest Oldest Best

 

@Margaret771

Here's the ruby script for the wikipedia tag scrape.


Select a batch of records from the DB
Fetch the wikipedia page
Perform an XPath search for the tags that might contain the color
Do a regex match for possible color attributes
Repeat until 2 matches are found
Write the 2 matches to the fields in the DB record


Happy parsing.

require 'open-uri'
require 'nokogiri'
require 'sequel'
@last = '"Tennessee-Martin"'

DATABASE_FILE = '../development.sqlite3'

DB = Sequel.sqlite('[your db path]/db/development.sqlite3')
@teamtags = DB.fetch('select teams.id as i, teams.name as t, tags.tag_value as n from teams, tags where tags.team_id = teams.id and tags.tag_name = "TeamName" and teams.name > ' + @last )

def hexColor(s)
if (s =~ /(background|background-color):[ ]{0,1}#[a-fA-F0-9]{6}/)
@match = %Q!#{$&}!
@match =~ /#[a-fA-F0-9]{6}/
@color = %Q!#{$&}!
@colors [@matches] = @color
return true
end
end

@teamtags .each do |team|
@searchterm = team[:t] + " "+ team[:n]

@searchterm = @searchterm .gsub(/ /,"+")
doc = Nokogiri::HTML(open("http://en.wikipedia.org/w/index.php?title=Special:Search&search="+@searchterm))

@matches = 0
@colors =["",""]
# Print out each link using a CSS selector
doc.xpath('//td//span').each do |span|
#puts span
if @matches < 2
#puts @matches
if hexColor(span.to_s)
@matches = @matches + 1
end
end
end
puts team[:i].to_s + " => " + @colors [0] + " | " + @colors [1]
DB[:teams].where(:id => team[:i]).update :primary_color => @colors [0], :secondary_color=>@colors[1]
sleep 2 + rand(4)
end

10% popularity Vote Up Vote Down


 

@RJPawlick971

Sorry for letting this question get stale. I'm primarily a Stack Overflow user, and was advised to post this question here.

I ended up writing a ruby script to search Wikipedia by school and team name, look for the school colors span tags and pull the background color values. Results were surprisingly good. I got about 80% of the division 1 teams primary and secondary colors on the first pass through and then did some spot checking and clean up. I'll get around to posting this somewhere, if anyone else stumbles on this and is in need you can message me for the data.

Here's the google doc with the rough pull. If you use this and do any cleanup, I'd appreciated you passing on the fixes :)

Google spreadsheet: US Athletic Team Colors 0.1

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme