[フレーム]
Last Updated: February 25, 2016
·
1.299K
· cassioscabral

Programming language colors Github

<% require 'yaml' %>
<% languages = YAML.load_file('config/languages.yml') %>
<% languages.each do |l| %>
 <% color = l[1]["color"] %>
 <% programming_language = l[0].downcase.tr("#", "").gsub("++", "pp").gsub(" ", "-") %>
 <% if color.present? %>
 <%= ".#{programming_language}-color {" %>
 background: <%= color %>;
 <%= "}" %>
 <% end %>
<% end %>

I used Linguist languages.yml
to get all colors used on Github.

In my Rails app, inside a scss.erb I used this script above to get all colours and create classes to each one of them. To be more efficient after created once I got the css generated, removed the comments lines with sublime replace all with a Regex(expression == /*(.)*/)

The easy solution: Css with all the classes and their colors; I used background, but you could change in the script to match your requirements.

AltStyle によって変換されたページ (->オリジナル) /