diff --git a/README.md b/README.md index 72aacb2..6e1b528 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,24 @@ For example, I personally think it would really spiff up a [personal website](ht # Color Schemes -We also support custom color schemes! You can provide any base color and we will make shades for the chart. Just visit `https://ghchart.rshah.org//2016rshah` and replace `` with your hex color code, not including the leading hashtag. For example if you want a blue-themed chart that is based around the hex color `#409ba5`, you can visit the following route: +We also support custom color schemes! You can provide any base color and we will make shades for the chart. + +``` +https://ghchart.rshah.org//2016rshah +``` +Replace ```BASE-COLOR``` with a hex string eg: ```ff0000``` + +``` +https://ghchart.rshah.org///2016rshah +``` +Replace ```BASE-COLOR``` & ```BG-COLOR``` with a hex string eg: ```ff0000``` + + +2016rshah's Github chart + +2016rshah's Github chart - 2016rshah's Blue Github Chart -![2016rshah's Blue Github Chart](https://ghchart.rshah.org/409ba5/2016rshah) # Contributing diff --git a/app.rb b/app.rb index dd7fbdd..1ba8cbf 100644 --- a/app.rb +++ b/app.rb @@ -24,7 +24,9 @@ end end + get '/:base/:username' do + # Custom color scheme, with default background headers 'Cache-Control' => "max-age=#{60*60*24}" headers 'Content-Type' => "image/svg+xml" @@ -44,3 +46,27 @@ out << svg end end + + +get '/:base/:background/:username' do + # Custom color scheme, with custom background + headers 'Cache-Control' => "max-age=#{60*60*24}" + headers 'Content-Type' => "image/svg+xml" + + username = params[:username].chomp('.svg') + + #Makes API backwards compatible + if(params[:base] == "teal" || params[:base] == "halloween" || params[:base] == "default") + scheme = COLOR_SCHEMES[params[:base].to_sym] + else + #this case will be executed a majority of the time + base_color = '#'+params[:base] + background_color = '#'+params[:background] + scheme = [background_color, lighten_color(base_color, 0.3), lighten_color(base_color, 0.2), base_color, darken_color(base_color, 0.8)] + end + + svg = GithubChart.new(user: username, colors: scheme).render('svg') + stream do |out| + out << svg + end +end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy